//===-- APFloat.cpp - Implement APFloat class -----------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file was developed by Neil Booth and is distributed under the
// University of Illinois Open Source License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
// This file implements a class to represent arbitrary precision floating
// point values and provide a variety of arithmetic operations on them.
//
//===----------------------------------------------------------------------===//
#include <cassert>
#include "llvm/ADT/APFloat.h"
using namespace llvm;
#define convolve(lhs, rhs) ((lhs) * 4 + (rhs))
/* Assumed in hexadecimal significand parsing. */
COMPILE_TIME_ASSERT(integerPartWidth % 4 == 0);
namespace llvm {
/* Represents floating point arithmetic semantics. */
struct fltSemantics {
/* The largest E such that 2^E is representable; this matches the
definition of IEEE 754. */
exponent_t maxExponent;
/* The smallest E such that 2^E is a normalized number; this
matches the definition of IEEE 754. */
exponent_t minExponent;
/* Number of bits in the significand. This includes the integer
bit. */
unsigned char precision;
/* If the target format has an implicit integer bit. */
bool implicitIntegerBit;
};
const fltSemantics APFloat::IEEEsingle = { 127, -126, 24, true };
const fltSemantics APFloat::IEEEdouble = { 1023, -1022, 53, true };
const fltSemantics APFloat::IEEEquad = { 16383,