OLD | NEW |
---|---|
1 //===-- subzero/src/IceAPFloat.h - Constant float conversions --*- C++ -*--===// | 1 //===-- subzero/src/IceAPFloat.h - Constant float conversions --*- C++ -*--===// |
2 // | 2 // |
3 // The LLVM Compiler Infrastructure | 3 // The LLVM Compiler Infrastructure |
4 // | 4 // |
5 // This file is distributed under the University of Illinois Open Source | 5 // This file is distributed under the University of Illinois Open Source |
6 // License. See LICENSE.TXT for details. | 6 // License. See LICENSE.TXT for details. |
7 // | 7 // |
8 //===----------------------------------------------------------------------===// | 8 //===----------------------------------------------------------------------===// |
9 /// | 9 /// |
10 /// \file | 10 /// \file |
11 /// \brief This file implements a class to represent Subzero float and double | 11 /// \brief Implements a class to represent float and double |
Jim Stichnoth
2015/12/01 18:41:15
Reflow to 80-col
rkotlerimgtec
2015/12/02 01:32:47
this file has been deleted
| |
12 /// values. | 12 /// values. |
13 /// | 13 /// |
14 /// Note: This is a simplified version of llvm/include/llvm/ADT/APFloat.h for | 14 /// Note: This is a simplified version of llvm/include/llvm/ADT/APFloat.h for |
15 /// use with Subzero. | 15 /// use with Subzero. |
16 //===----------------------------------------------------------------------===// | 16 //===----------------------------------------------------------------------===// |
17 | 17 |
18 #ifndef SUBZERO_SRC_ICEAPFLOAT_H | 18 #ifndef SUBZERO_SRC_ICEAPFLOAT_H |
19 #define SUBZERO_SRC_ICEAPFLOAT_H | 19 #define SUBZERO_SRC_ICEAPFLOAT_H |
20 | 20 |
21 #include "IceAPInt.h" | 21 #include "IceAPInt.h" |
22 | 22 |
23 namespace Ice { | 23 namespace Ice { |
24 | 24 |
25 template <typename IntType, typename FpType> | 25 template <typename IntType, typename FpType> |
26 inline FpType convertAPIntToFp(const APInt &Int) { | 26 inline FpType convertAPIntToFp(const APInt &Int) { |
27 static_assert(sizeof(IntType) == sizeof(FpType), | 27 static_assert(sizeof(IntType) == sizeof(FpType), |
28 "IntType and FpType should be the same width"); | 28 "IntType and FpType should be the same width"); |
29 assert(Int.getBitWidth() == sizeof(IntType) * CHAR_BIT); | 29 assert(Int.getBitWidth() == sizeof(IntType) * CHAR_BIT); |
30 union { | 30 union { |
31 IntType IntValue; | 31 IntType IntValue; |
32 FpType FpValue; | 32 FpType FpValue; |
33 } Converter; | 33 } Converter; |
34 Converter.IntValue = static_cast<IntType>(Int.getRawData()); | 34 Converter.IntValue = static_cast<IntType>(Int.getRawData()); |
35 return Converter.FpValue; | 35 return Converter.FpValue; |
36 } | 36 } |
37 | 37 |
38 } // end of namespace Ice | 38 } // end of namespace Ice |
39 | 39 |
40 #endif // SUBZERO_SRC_ICEAPFLOAT_H | 40 #endif // SUBZERO_SRC_ICEAPFLOAT_H |
OLD | NEW |