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

checker: warn when casting between reference types outside of unsafe (#7892)

This commit is contained in:
Nick Treleaven
2021-01-05 15:02:04 +00:00
committed by GitHub
parent eaba21d81a
commit 3203a124b2
9 changed files with 22 additions and 16 deletions

View File

@ -6,7 +6,7 @@ module math
// with the sign bit of f and the result in the same bit position.
// f32_bits(f32_from_bits(x)) == x.
pub fn f32_bits(f f32) u32 {
p := *(&u32(&f))
p := *unsafe {&u32(&f)}
return p
}
@ -15,7 +15,7 @@ pub fn f32_bits(f f32) u32 {
// and the result in the same bit position.
// f32_from_bits(f32_bits(x)) == x.
pub fn f32_from_bits(b u32) f32 {
p := *(&f32(&b))
p := *unsafe {&f32(&b)}
return p
}
@ -23,7 +23,7 @@ pub fn f32_from_bits(b u32) f32 {
// with the sign bit of f and the result in the same bit position,
// and f64_bits(f64_from_bits(x)) == x.
pub fn f64_bits(f f64) u64 {
p := *(&u64(&f))
p := *unsafe {&u64(&f)}
return p
}
@ -32,7 +32,7 @@ pub fn f64_bits(f f64) u64 {
// and the result in the same bit position.
// f64_from_bits(f64_bits(x)) == x.
pub fn f64_from_bits(b u64) f64 {
p := *(&f64(&b))
p := *unsafe {&f64(&b)}
return p
}