Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(9)

Side by Side Diff: src/IceAPFloat.h

Issue 797323002: Simplify LLVM's APInt and APFloat for use in Subzero. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Fix misspelling. Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | src/IceAPInt.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 //===-- subzero/src/IceAPFloat.h - Constant float conversions --*- C++ -*--===//
2 //
3 // The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 ///
10 /// \file
11 /// \brief This file implements a class to represent Subzero float and double
12 /// values.
13 ///
14 /// Note: This is a simplified version of
15 /// llvm/include/llvm/ADT/APFloat.h for use with Subzero.
16 //===----------------------------------------------------------------------===//
17
18 #ifndef SUBZERO_SRC_ICEAPFLOAT_H
19 #define SUBZERO_SRC_ICEAPFLOAT_H
20
21 #include "IceAPInt.h"
22
23 namespace Ice {
24
25 template <typename IntType, typename FpType>
26 inline FpType convertAPIntToFp(const APInt &Int) {
27 static_assert(sizeof(IntType) == sizeof(FpType),
28 "IntType and FpType should be the same width");
29 assert(Int.getBitWidth() == sizeof(IntType) * CHAR_BIT);
30 union {
31 IntType IntValue;
32 FpType FpValue;
33 } Converter;
34 Converter.IntValue = static_cast<IntType>(Int.getRawData());
35 return Converter.FpValue;
36 }
37
38 } // end of namespace Ice
39
40 #endif // SUBZERO_SRC_ICEAPFLOAT_H
OLDNEW
« no previous file with comments | « no previous file | src/IceAPInt.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698