mirror of
https://git.FreeBSD.org/src.git
synced 2025-01-11 14:10:34 +00:00
no-op commit to note that the example given in the previous commit is
a very bad one, since the shift does not actually overflow. This is a better example (assuming uint64_t = unsigned long long): ~0LLU >> 9 = 0x7fffffffffffffLLU ~0LLU >> 9 << 10 = 0xfffffffffffffc00LLU ~0LLU >> 9 << 10 >> 10 = 0x3fffffffffffffLLU
This commit is contained in:
parent
1035d74025
commit
b6fbd4d50d
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=211338
@ -66,7 +66,7 @@ expand_number(const char *buf, uint64_t *num)
|
||||
return (0);
|
||||
}
|
||||
|
||||
#define SHIFT(n, b) \
|
||||
#define SHIFT(n, b) \
|
||||
do { if (((n << b) >> b) != n) goto overflow; n <<= b; } while (0)
|
||||
|
||||
switch (tolower((unsigned char)*endptr)) {
|
||||
|
Loading…
Reference in New Issue
Block a user