aboutsummaryrefslogtreecommitdiffstats
path: root/src/utils/util.h
diff options
context:
space:
mode:
authorlloyd <[email protected]>2009-09-17 13:48:12 +0000
committerlloyd <[email protected]>2009-09-17 13:48:12 +0000
commit7d51181d2841b29277da9a31752cae612d64b534 (patch)
treeb5554f4d2e41d1660f6ae1e996f5ff937637cc57 /src/utils/util.h
parent268c1b8902fccc4e942f6ccd5651dab826846a92 (diff)
Move memory locking function decls to mlock.h
Inline round_up and round_down
Diffstat (limited to 'src/utils/util.h')
-rw-r--r--src/utils/util.h18
1 files changed, 12 insertions, 6 deletions
diff --git a/src/utils/util.h b/src/utils/util.h
index ac7867390..e3dadc64b 100644
--- a/src/utils/util.h
+++ b/src/utils/util.h
@@ -18,16 +18,22 @@ namespace Botan {
BOTAN_DLL u64bit system_time();
/*
-* Memory Locking Functions
+* Round up n to multiple of align_to
*/
-BOTAN_DLL bool lock_mem(void*, u32bit);
-BOTAN_DLL void unlock_mem(void*, u32bit);
+inline u32bit round_up(u32bit n, u32bit align_to)
+ {
+ if(n % align_to || n == 0)
+ n += align_to - (n % align_to);
+ return n;
+ }
/*
-* Misc Utility Functions
+* Round down n to multiple of align_to
*/
-BOTAN_DLL u32bit round_up(u32bit, u32bit);
-BOTAN_DLL u32bit round_down(u32bit, u32bit);
+inline u32bit round_down(u32bit n, u32bit align_to)
+ {
+ return (n - (n % align_to));
+ }
/*
* Work Factor Estimates