LEFT | RIGHT |
(no file at all) | |
1 // Copyright 2009 The Go Authors. All rights reserved. | 1 // Copyright 2009 The Go Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style | 2 // Use of this source code is governed by a BSD-style |
3 // license that can be found in the LICENSE file. | 3 // license that can be found in the LICENSE file. |
4 | 4 |
5 #include "runtime.h" | 5 #include "runtime.h" |
6 | 6 |
7 static» uint64» uvnan» » = 0x7FF0000000000001ULL; | 7 static» uint64» uvnan» » = 0x7FF8000000000001ULL; |
8 static uint64 uvinf = 0x7FF0000000000000ULL; | 8 static uint64 uvinf = 0x7FF0000000000000ULL; |
9 static uint64 uvneginf = 0xFFF0000000000000ULL; | 9 static uint64 uvneginf = 0xFFF0000000000000ULL; |
10 | 10 |
11 uint32 | 11 uint32 |
12 runtime·float32tobits(float32 f) | 12 runtime·float32tobits(float32 f) |
13 { | 13 { |
14 // The obvious cast-and-pointer code is technically | 14 // The obvious cast-and-pointer code is technically |
15 // not valid, and gcc miscompiles it. Use a union instead. | 15 // not valid, and gcc miscompiles it. Use a union instead. |
16 union { | 16 union { |
17 float32 f; | 17 float32 f; |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
164 /* | 164 /* |
165 * Keep the top 11+e bits; clear the rest. | 165 * Keep the top 11+e bits; clear the rest. |
166 */ | 166 */ |
167 if(e <= 64-11) | 167 if(e <= 64-11) |
168 x &= ~(((uint64)1 << (64LL-11LL-e))-1); | 168 x &= ~(((uint64)1 << (64LL-11LL-e))-1); |
169 dd = runtime·float64frombits(x); | 169 dd = runtime·float64frombits(x); |
170 *ip = dd; | 170 *ip = dd; |
171 return d - dd; | 171 return d - dd; |
172 } | 172 } |
173 | 173 |
LEFT | RIGHT |