[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[MiNT] [PATCH] Add more useful macros to kcompiler.h
Hi Alan,
could you please commit this patch.
Thanks!
Commit message:
Add MAX3, MIN3, ROUNDUP and ROUNDDOWN macros
Index: sys/mint/kcompiler.h
===================================================================
RCS file: /mint/freemint/sys/mint/kcompiler.h,v
retrieving revision 1.10
diff -u -8 -r1.10 kcompiler.h
--- sys/mint/kcompiler.h 12 Oct 2013 09:03:40 -0000 1.10
+++ sys/mint/kcompiler.h 29 Apr 2014 09:41:33 -0000
@@ -104,12 +104,17 @@
/*
* useful makros
*/
# define MAX(a,b) (((a) > (b)) ? (a) : (b))
# define MIN(a,b) (((a) > (b)) ? (b) : (a))
+# define MAX3(a,b,c) ((a) > (b) ? ((a) > (c) ? (a) : (c)) : ((b) > (c) ? (b) : (c)))
+# define MIN3(a,b,c) ((a) < (b) ? ((a) < (c) ? (a) : (c)) : ((b) < (c) ? (b) : (c)))
+
# define ABS(val) (((val) < 0) ? -val : val)
+# define ROUNDUP(a,b) ((((a) + ((b) - 1)) / (b)) * (b))
+# define ROUNDDOWN(a,b) (((a) / (b)) * (b))
# endif /* _mint_misc_h */
Index: sys/sys/gmon.h
===================================================================
RCS file: /mint/freemint/sys/sys/gmon.h,v
retrieving revision 1.3
diff -u -8 -r1.3 gmon.h
--- sys/sys/gmon.h 3 Mar 2012 11:52:00 -0000 1.3
+++ sys/sys/gmon.h 29 Apr 2014 09:41:33 -0000
@@ -127,22 +127,16 @@
struct rawarc
{
ulong raw_frompc;
ulong raw_selfpc;
long raw_count;
};
/*
- * general rounding functions.
- */
-# define ROUNDDOWN(x,y) (((x)/(y))*(y))
-# define ROUNDUP(x,y) ((((x)+(y)-1)/(y))*(y))
-
-/*
* The profiling data structures are housed in this structure.
*/
struct gmonparam
{
long state;
ushort *kcount;
ulong kcountsize;
ushort *froms;