aboutsummaryrefslogtreecommitdiff
path: root/zencore/include
diff options
context:
space:
mode:
authorMartin Ridgers <[email protected]>2021-09-29 15:46:15 +0200
committerMartin Ridgers <[email protected]>2021-09-29 16:57:32 +0200
commitb4e4fc8059611966877dea440646a63628d06ab3 (patch)
treeba7ca29f4e462d63409706a71c9c62708f57befd /zencore/include
parentreadlink() parameters should not alias each other (diff)
downloadzen-b4e4fc8059611966877dea440646a63628d06ab3.tar.xz
zen-b4e4fc8059611966877dea440646a63628d06ab3.zip
Log2 could be used uninitialised if mask passed argument to BitScanRev() was 0
Diffstat (limited to 'zencore/include')
-rw-r--r--zencore/include/zencore/intmath.h6
1 files changed, 3 insertions, 3 deletions
diff --git a/zencore/include/zencore/intmath.h b/zencore/include/zencore/intmath.h
index 7619e1950..0d0ceff16 100644
--- a/zencore/include/zencore/intmath.h
+++ b/zencore/include/zencore/intmath.h
@@ -107,7 +107,7 @@ FloorLog2(uint32_t Value)
static inline uint32_t
CountLeadingZeros(uint32_t Value)
{
- unsigned long Log2;
+ unsigned long Log2 = 0;
_BitScanReverse64(&Log2, (uint64_t(Value) << 1) | 1);
return 32 - Log2;
}
@@ -115,7 +115,7 @@ CountLeadingZeros(uint32_t Value)
static inline uint64_t
FloorLog2_64(uint64_t Value)
{
- unsigned long Log2;
+ unsigned long Log2 = 0;
long Mask = -long(_BitScanReverse64(&Log2, Value) != 0);
return Log2 & Mask;
}
@@ -123,7 +123,7 @@ FloorLog2_64(uint64_t Value)
static inline uint64_t
CountLeadingZeros64(uint64_t Value)
{
- unsigned long Log2;
+ unsigned long Log2 = 0;
long Mask = -long(_BitScanReverse64(&Log2, Value) != 0);
return ((63 - Log2) & Mask) | (64 & ~Mask);
}