瀏覽代碼

Merge branch 'maint-0.3.2'

Nick Mathewson 6 年之前
父節點
當前提交
b62b40a572
共有 2 個文件被更改,包括 7 次插入2 次删除
  1. 5 0
      changes/bug24633
  2. 2 2
      src/ext/timeouts/timeout-bitops.c

+ 5 - 0
changes/bug24633

@@ -0,0 +1,5 @@
+  o Minor bugfixes (portability, msvc):
+    - Fix a bug in the bit-counting parts of our timing-wheel code on
+      MSVC. (Note that MSVC is still not a supported build platform,
+      due to cyptographic timing channel risks.) Fixes bug 24633;
+      bugfix on 0.2.9.1-alpha.

+ 2 - 2
src/ext/timeouts/timeout-bitops.c

@@ -40,7 +40,7 @@ static __inline int clz32(unsigned long val)
 {
 	DWORD zeros = 0;
 	_BitScanReverse(&zeros, val);
-	return zeros;
+	return 31 - zeros;
 }
 #ifdef _WIN64
 /* According to the documentation, these only exist on Win64. */
@@ -54,7 +54,7 @@ static __inline int clz64(uint64_t val)
 {
 	DWORD zeros = 0;
 	_BitScanReverse64(&zeros, val);
-	return zeros;
+	return 63 - zeros;
 }
 #else
 static __inline int ctz64(uint64_t val)