From dca19fc4ef14f2b4869271e51d608624ca23a4b1 Mon Sep 17 00:00:00 2001 From: Anton Korobeynikov Date: Sun, 14 Oct 2012 01:40:58 +0400 Subject: [PATCH] Make sure the op does not change the sign of the operand Summary: . Test Plan: . Reviewed By: soren@fb.com FB internal diff: D660143 Blame Revision: --- folly/small_vector.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/folly/small_vector.h b/folly/small_vector.h index 911f0630..cf9caa6e 100644 --- a/folly/small_vector.h +++ b/folly/small_vector.h @@ -414,7 +414,8 @@ namespace detail { } template T* pointerFlagClear(T* p) { - return reinterpret_cast(reinterpret_cast(p) & ~1); + return reinterpret_cast( + reinterpret_cast(p) & ~uintptr_t(1)); } inline void* shiftPointer(void* p, size_t sizeBytes) { return static_cast(p) + sizeBytes; -- 2.34.1