From 76d520cde05356911c2f9c6f318e437d9416b621 Mon Sep 17 00:00:00 2001 From: buslov Date: Mon, 30 Oct 2017 20:50:20 +0300 Subject: [PATCH] Fix V629 warning from PVS-Studio Static Analyzer Consider inspecting the '1 << bit' expression. Bit shifting of the 32-bit value with a subsequent expansion to the 64-bit type. --- src/bitarray.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/bitarray.c b/src/bitarray.c index b751231..d2664d3 100644 --- a/src/bitarray.c +++ b/src/bitarray.c @@ -29,10 +29,10 @@ bool bitarrayModify (bitarray* bits, int index, bool set) { bit = index % bitsPerWord; if (set) - bits->array[word] |= 1 << bit; + bits->array[word] |= 1LL << bit; else - bits->array[word] &= ~(1 << bit); + bits->array[word] &= ~(1LL << bit); return true; } @@ -52,5 +52,5 @@ bitarrayWord bitarrayTest (const bitarray* bits, int index) { int word = index / bitsPerWord, bit = index % bitsPerWord; - return bits->array[word] & (1 << bit); + return bits->array[word] & (1LL << bit); }