Avoid undefined behavior in *BIT macros
hash_page.c:792:2, left shift of 1 by 31 places cannot be represented in type 'int' hash_page.c:855:2, left shift of 1 by 31 places cannot be represented in type 'int' hash_page.c:779:3, left shift of 1 by 31 places cannot be represented in type 'int'
This commit is contained in:
parent
e3ba625111
commit
ca9a018f12
|
@ -1,4 +1,4 @@
|
||||||
/* $NetBSD: hash.h,v 1.16 2015/11/18 18:22:42 christos Exp $ */
|
/* $NetBSD: hash.h,v 1.17 2020/02/21 22:04:06 kamil Exp $ */
|
||||||
|
|
||||||
/*-
|
/*-
|
||||||
* Copyright (c) 1990, 1993, 1994
|
* Copyright (c) 1990, 1993, 1994
|
||||||
|
@ -156,9 +156,9 @@ typedef struct htab { /* Memory resident data structure */
|
||||||
#define BITS_PER_MAP 32
|
#define BITS_PER_MAP 32
|
||||||
|
|
||||||
/* Given the address of the beginning of a big map, clear/set the nth bit */
|
/* Given the address of the beginning of a big map, clear/set the nth bit */
|
||||||
#define CLRBIT(A, N) ((A)[(N)/BITS_PER_MAP] &= ~(1<<((N)%BITS_PER_MAP)))
|
#define CLRBIT(A, N) ((A)[(N)/BITS_PER_MAP] &= ~(1U<<((N)%BITS_PER_MAP)))
|
||||||
#define SETBIT(A, N) ((A)[(N)/BITS_PER_MAP] |= (1<<((N)%BITS_PER_MAP)))
|
#define SETBIT(A, N) ((A)[(N)/BITS_PER_MAP] |= (1U<<((N)%BITS_PER_MAP)))
|
||||||
#define ISSET(A, N) ((A)[(N)/BITS_PER_MAP] & (1<<((N)%BITS_PER_MAP)))
|
#define ISSET(A, N) ((A)[(N)/BITS_PER_MAP] & (1U<<((N)%BITS_PER_MAP)))
|
||||||
|
|
||||||
/* Overflow management */
|
/* Overflow management */
|
||||||
/*
|
/*
|
||||||
|
|
Loading…
Reference in New Issue