libstdc++: Avoid -Wmaybe-uninitialized warnings in text_encoding.cc
[official-gcc.git] / libgo / go / math / unsafe.go
blobe59f50ca62e5cc4ecdcc334b319093c5ef6a905d
1 // Copyright 2009 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file.
5 package math
7 import "unsafe"
9 // Float32bits returns the IEEE 754 binary representation of f,
10 // with the sign bit of f and the result in the same bit position.
11 // Float32bits(Float32frombits(x)) == x.
12 func Float32bits(f float32) uint32 { return *(*uint32)(unsafe.Pointer(&f)) }
14 // Float32frombits returns the floating-point number corresponding
15 // to the IEEE 754 binary representation b, with the sign bit of b
16 // and the result in the same bit position.
17 // Float32frombits(Float32bits(x)) == x.
18 func Float32frombits(b uint32) float32 { return *(*float32)(unsafe.Pointer(&b)) }
20 // Float64bits returns the IEEE 754 binary representation of f,
21 // with the sign bit of f and the result in the same bit position,
22 // and Float64bits(Float64frombits(x)) == x.
23 func Float64bits(f float64) uint64 { return *(*uint64)(unsafe.Pointer(&f)) }
25 // Float64frombits returns the floating-point number corresponding
26 // to the IEEE 754 binary representation b, with the sign bit of b
27 // and the result in the same bit position.
28 // Float64frombits(Float64bits(x)) == x.
29 func Float64frombits(b uint64) float64 { return *(*float64)(unsafe.Pointer(&b)) }