From: Anton Korobeynikov Date: Sat, 13 Oct 2012 21:40:58 +0000 (+0400) Subject: Make sure the op does not change the sign of the operand X-Git-Tag: v0.22.0~1105 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=dca19fc4ef14f2b4869271e51d608624ca23a4b1;p=folly.git 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: --- 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;