This assert won't catch all mistakes with this helper but it will at
least ensure that the top bits are all zero or all one which should help
catch bugs.
Reviewed-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
+ assert(bit_size == 64 ||
+ (int64_t)x >> bit_size == 0 ||
+ (int64_t)x >> bit_size == -1);
+
memset(&v, 0, sizeof(v));
assert(bit_size <= 64);
v.i64[0] = x & (~0ull >> (64 - bit_size));
memset(&v, 0, sizeof(v));
assert(bit_size <= 64);
v.i64[0] = x & (~0ull >> (64 - bit_size));