From 8d744058393a40ca2419053551e5aeadc0bec461 Mon Sep 17 00:00:00 2001 From: proski Date: Thu, 24 Jul 2008 02:05:54 +0000 Subject: [PATCH] Copy new macros from the DFS branch git-svn-id: http://madwifi-project.org/svn/madwifi/trunk@3823 0192ed92-7a03-0410-a25b-9323aeb14dbd --- include/compat.h | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/include/compat.h b/include/compat.h index a94019b..f8835ec 100644 --- a/include/compat.h +++ b/include/compat.h @@ -90,6 +90,15 @@ #define howmany(x, y) (((x)+((y)-1))/(y)) +/* roundup() and howmany() macros that works both with positive and negative + * values. */ +#define roundup_s(x,y) _roundup_s((signed)(x),(signed)(y)) +#define howmany_s(x,y) _howmany_s((signed)(x),(signed)(y)) +#define _roundup_s(x,y) \ + ((x) >= 0 ? (((x)+((y)-1))/(y))*(y) : ((x)/(y))*(y)) +#define _howmany_s(x, y) \ + ((x) >= 0 ? (((x)+((y)-1))/(y)) : ((x)/(y))) + /* Bit map related macros. */ #define setbit(a,i) ((a)[(i)/NBBY] |= 1<<((i)%NBBY)) #define clrbit(a,i) ((a)[(i)/NBBY] &= ~(1<<((i)%NBBY)))