aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/utils
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/utils')
-rw-r--r--src/lib/utils/mem_pool/mem_pool.cpp2
-rw-r--r--src/lib/utils/os_utils.cpp9
2 files changed, 6 insertions, 5 deletions
diff --git a/src/lib/utils/mem_pool/mem_pool.cpp b/src/lib/utils/mem_pool/mem_pool.cpp
index d25343383..e052c10e7 100644
--- a/src/lib/utils/mem_pool/mem_pool.cpp
+++ b/src/lib/utils/mem_pool/mem_pool.cpp
@@ -63,7 +63,7 @@ Memory_Pool::Memory_Pool(uint8_t* pool,
void* Memory_Pool::allocate(size_t req)
{
- const size_t alignment = (1 << m_align_bit);
+ const size_t alignment = (static_cast<size_t>(1) << m_align_bit);
if(req > m_pool_size)
return nullptr;
diff --git a/src/lib/utils/os_utils.cpp b/src/lib/utils/os_utils.cpp
index 7d50dac77..86e5443c3 100644
--- a/src/lib/utils/os_utils.cpp
+++ b/src/lib/utils/os_utils.cpp
@@ -216,20 +216,21 @@ uint64_t OS::get_system_timestamp_ns()
size_t OS::system_page_size()
{
+ const size_t default_page_size = 4096;
+
#if defined(BOTAN_TARGET_OS_HAS_POSIX1)
long p = ::sysconf(_SC_PAGESIZE);
if(p > 1)
return static_cast<size_t>(p);
else
- return 4096;
+ return default_page_size;
#elif defined(BOTAN_TARGET_OS_HAS_VIRTUAL_LOCK)
SYSTEM_INFO sys_info;
::GetSystemInfo(&sys_info);
return sys_info.dwPageSize;
+#else
+ return default_page_size;
#endif
-
- // default value
- return 4096;
}
size_t OS::get_memory_locking_limit()