mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
math: use automatic dereferencing
This commit is contained in:
parent
b5cb1b1fe2
commit
be01a32f0b
@ -7,7 +7,7 @@ module math
|
|||||||
// f32_bits(f32_from_bits(x)) == x.
|
// f32_bits(f32_from_bits(x)) == x.
|
||||||
pub fn f32_bits(f f32) u32 {
|
pub fn f32_bits(f f32) u32 {
|
||||||
p := &u32(&f)
|
p := &u32(&f)
|
||||||
return *p
|
return p
|
||||||
}
|
}
|
||||||
|
|
||||||
// f32_from_bits returns the floating-point number corresponding
|
// f32_from_bits returns the floating-point number corresponding
|
||||||
@ -16,7 +16,7 @@ pub fn f32_bits(f f32) u32 {
|
|||||||
// f32_from_bits(f32_bits(x)) == x.
|
// f32_from_bits(f32_bits(x)) == x.
|
||||||
pub fn f32_from_bits(b u32) f32 {
|
pub fn f32_from_bits(b u32) f32 {
|
||||||
p := &f32(&b)
|
p := &f32(&b)
|
||||||
return *p
|
return p
|
||||||
}
|
}
|
||||||
|
|
||||||
// f64_bits returns the IEEE 754 binary representation of f,
|
// f64_bits returns the IEEE 754 binary representation of f,
|
||||||
@ -24,7 +24,7 @@ pub fn f32_from_bits(b u32) f32 {
|
|||||||
// and f64_bits(f64_from_bits(x)) == x.
|
// and f64_bits(f64_from_bits(x)) == x.
|
||||||
pub fn f64_bits(f f64) u64 {
|
pub fn f64_bits(f f64) u64 {
|
||||||
p := &u64(&f)
|
p := &u64(&f)
|
||||||
return *p
|
return p
|
||||||
}
|
}
|
||||||
|
|
||||||
// f64_from_bits returns the floating-point number corresponding
|
// f64_from_bits returns the floating-point number corresponding
|
||||||
@ -33,6 +33,6 @@ pub fn f64_bits(f f64) u64 {
|
|||||||
// f64_from_bits(f64_bits(x)) == x.
|
// f64_from_bits(f64_bits(x)) == x.
|
||||||
pub fn f64_from_bits(b u64) f64 {
|
pub fn f64_from_bits(b u64) f64 {
|
||||||
p := &f64(&b)
|
p := &f64(&b)
|
||||||
return *p
|
return p
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user