Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCorinna Vinschen <corinna@vinschen.de>2003-08-12 14:23:40 +0400
committerCorinna Vinschen <corinna@vinschen.de>2003-08-12 14:23:40 +0400
commitc86c10b803a309d887fd8d02160fe118ab31b531 (patch)
tree27b40d5eb82c208ec439d6ae7229430630bf83cd /winsup/cygwin
parent6c7560c9016d67d23d1ec358b07bfce94eecd292 (diff)
* include/sys/param.h (NBBY): Define if not defined.
* include/sys/param.h (setbit): Add new bitmap related macro. (clrbit): Likewise. (isset): Likewise. (isclr): Likewise. (howmany): Add new counting/rounding macro. (rounddown): Likewise. (roundup): Likewise. (roundup2): Likewise. (powerof2): Likewise (MIN): Add macro for calculating min. (MAX): Add macro for calculating max.
Diffstat (limited to 'winsup/cygwin')
-rw-r--r--winsup/cygwin/ChangeLog18
-rw-r--r--winsup/cygwin/include/sys/param.h23
2 files changed, 41 insertions, 0 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog
index cfd58efee..5f9c76fc2 100644
--- a/winsup/cygwin/ChangeLog
+++ b/winsup/cygwin/ChangeLog
@@ -1,3 +1,21 @@
+2003-08-12 Corinna Vinschen <corinna@vinschen.de>
+
+ * include/sys/param.h (NBBY): Define if not defined.
+
+2003-08-12 Nicholas Wourms <nwourms@netscape.net>
+
+ * include/sys/param.h (setbit): Add new bitmap related macro.
+ (clrbit): Likewise.
+ (isset): Likewise.
+ (isclr): Likewise.
+ (howmany): Add new counting/rounding macro.
+ (rounddown): Likewise.
+ (roundup): Likewise.
+ (roundup2): Likewise.
+ (powerof2): Likewise
+ (MIN): Add macro for calculating min.
+ (MAX): Add macro for calculating max.
+
2003-08-09 Christopher Faylor <cgf@redhat.com>
* include/cygwin/version.h: Bump DLL minor number to 3.
diff --git a/winsup/cygwin/include/sys/param.h b/winsup/cygwin/include/sys/param.h
index 5469cc70b..811b5ee56 100644
--- a/winsup/cygwin/include/sys/param.h
+++ b/winsup/cygwin/include/sys/param.h
@@ -53,4 +53,27 @@
#define NULL 0L
#endif
+#ifndef NBBY
+#define NBBY 8
+#endif
+
+/* Bit map related macros. */
+#define setbit(a,i) ((a)[(i)/NBBY] |= 1<<((i)%NBBY))
+#define clrbit(a,i) ((a)[(i)/NBBY] &= ~(1<<((i)%NBBY)))
+#define isset(a,i) ((a)[(i)/NBBY] & (1<<((i)%NBBY)))
+#define isclr(a,i) (((a)[(i)/NBBY] & (1<<((i)%NBBY))) == 0)
+
+/* Macros for counting and rounding. */
+#ifndef howmany
+#define howmany(x, y) (((x)+((y)-1))/(y))
+#endif
+#define rounddown(x, y) (((x)/(y))*(y))
+#define roundup(x, y) ((((x)+((y)-1))/(y))*(y)) /* to any y */
+#define roundup2(x, y) (((x)+((y)-1))&(~((y)-1))) /* if y is powers of two */
+#define powerof2(x) ((((x)-1)&(x))==0)
+
+/* Macros for min/max. */
+#define MIN(a,b) (((a)<(b))?(a):(b))
+#define MAX(a,b) (((a)>(b))?(a):(b))
+
#endif