1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

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
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