class FixedPointSemantics

Declaration

class FixedPointSemantics { /* full declaration omitted */ };

Description

The fixed point semantics work similarly to fltSemantics. The width specifies the whole bit width of the underlying scaled integer (with padding if any). The scale represents the number of fractional bits in this type. When HasUnsignedPadding is true and this type is unsigned, the first bit in the value this represents is treated as padding.

Declared at: llvm/include/llvm/ADT/APFixedPoint.h:33

Member Variables

private unsigned int Width
private unsigned int Scale
private unsigned int IsSigned
private unsigned int IsSaturated
private unsigned int HasUnsignedPadding

Method Overview

Methods

FixedPointSemantics(unsigned int Width,
                    unsigned int Scale,
                    bool IsSigned,
                    bool IsSaturated,
                    bool HasUnsignedPadding)

Declared at: llvm/include/llvm/ADT/APFixedPoint.h:35

Parameters

unsigned int Width
unsigned int Scale
bool IsSigned
bool IsSaturated
bool HasUnsignedPadding

static llvm::FixedPointSemantics
GetIntegerSemantics(unsigned int Width,
                    bool IsSigned)

Description

Return the FixedPointSemantics for an integer type.

Declared at: llvm/include/llvm/ADT/APFixedPoint.h:79

Parameters

unsigned int Width
bool IsSigned

bool fitsInFloatSemantics(
    const llvm::fltSemantics& FloatSema) const

Description

Returns true if this fixed-point semantic with its value bits interpreted as an integer can fit in the given floating point semantic without overflowing to infinity. For example, a signed 8-bit fixed-point semantic has a maximum and minimum integer representation of 127 and -128, respectively. If both of these values can be represented (possibly inexactly) in the floating point semantic without overflowing, this returns true.

Declared at: llvm/include/llvm/ADT/APFixedPoint.h:76

Parameters

const llvm::fltSemantics& FloatSema

llvm::FixedPointSemantics getCommonSemantics(
    const llvm::FixedPointSemantics& Other) const

Description

Return the FixedPointSemantics that allows for calculating the full precision semantic that can precisely represent the precision and ranges of both input values. This does not compute the resulting semantics for a given binary operation.

Declared at: llvm/include/llvm/ADT/APFixedPoint.h:67

Parameters

const llvm::FixedPointSemantics& Other

unsigned int getIntegralBits() const

Description

Return the number of integral bits represented by these semantics. These are separate from the fractional bits and do not include the sign or padding bit.

Declared at: llvm/include/llvm/ADT/APFixedPoint.h:55

unsigned int getScale() const

Declared at: llvm/include/llvm/ADT/APFixedPoint.h:45

unsigned int getWidth() const

Declared at: llvm/include/llvm/ADT/APFixedPoint.h:44

bool hasUnsignedPadding() const

Declared at: llvm/include/llvm/ADT/APFixedPoint.h:48

bool isSaturated() const

Declared at: llvm/include/llvm/ADT/APFixedPoint.h:47

bool isSigned() const

Declared at: llvm/include/llvm/ADT/APFixedPoint.h:46

void setSaturated(bool Saturated)

Declared at: llvm/include/llvm/ADT/APFixedPoint.h:50

Parameters

bool Saturated