checker: check int overflow for const vars (#16332)

This commit is contained in:
Swastik Baranwal 2022-11-06 10:52:28 +05:30 committed by GitHub
parent d701cf561c
commit ca484430e0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
12 changed files with 87 additions and 62 deletions

View file

@ -3,7 +3,7 @@ module constants
// Commonly used constants across RNGs - some taken from "Numerical Recipes".
pub const (
lower_mask = u64(0x00000000FFFFFFFF)
max_u32 = 0xFFFFFFFF
max_u32 = u32(0xFFFFFFFF)
max_u64 = u64(0xFFFFFFFFFFFFFFFF)
max_u32_as_f32 = f32(max_u32) + 1
max_u64_as_f64 = f64(max_u64) + 1