Cynerd commented on code in PR #17360:
URL: https://github.com/apache/nuttx/pull/17360#discussion_r2550055588


##########
include/sys/param.h:
##########
@@ -53,6 +53,32 @@
 #  define nitems(_a)    (sizeof(_a) / sizeof(0[(_a)]))
 #endif /* nitems */
 
+/* Macros for counting and rounding. */
+
+#ifndef howmany
+#  define howmany(a, b)        (((a) + ((b) - 1)) / (b))
+#endif /* howmany */
+
+#ifndef rounddown
+#  define      rounddown(a, b) (((a) / (b)) * (b))
+#endif /* rounddown */
+
+#ifndef rounddown2
+#  define      rounddown2(a, b) ((a) & ~((b) - 1))
+#endif /* rounddown2 */
+
+#ifndef roundup
+#  define      roundup(a, b)   ((((a) + ((b) - 1)) / (b)) * (b))
+#endif /* roundup */
+
+#ifndef roundup2
+#  define      roundup2(a, b)  (((a) + ((b) - 1)) & ~((b) - 1))
+#endif /* roundup2 */

Review Comment:
   Yeah, that is a good idea.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to