clang  8.0.0
Public Member Functions | Static Public Member Functions | List of all members
clang::APFixedPoint Class Reference

The APFixedPoint class works similarly to APInt/APSInt in that it is a functional replacement for a scaled integer. More...

#include "clang/Basic/FixedPoint.h"

Public Member Functions

 APFixedPoint (const llvm::APInt &Val, const FixedPointSemantics &Sema)
 
 APFixedPoint (uint64_t Val, const FixedPointSemantics &Sema)
 
llvm::APSInt getValue () const
 
unsigned getWidth () const
 
unsigned getScale () const
 
bool isSaturated () const
 
bool isSigned () const
 
bool hasPadding () const
 
APFixedPoint convert (const FixedPointSemantics &DstSema) const
 
APFixedPoint shr (unsigned Amt) const
 
APFixedPoint shl (unsigned Amt) const
 
llvm::APSInt getIntPart () const
 
int compare (const APFixedPoint &Other) const
 
bool operator== (const APFixedPoint &Other) const
 
bool operator!= (const APFixedPoint &Other) const
 
bool operator> (const APFixedPoint &Other) const
 
bool operator< (const APFixedPoint &Other) const
 
bool operator>= (const APFixedPoint &Other) const
 
bool operator<= (const APFixedPoint &Other) const
 

Static Public Member Functions

static APFixedPoint getMax (const FixedPointSemantics &Sema)
 
static APFixedPoint getMin (const FixedPointSemantics &Sema)
 

Detailed Description

The APFixedPoint class works similarly to APInt/APSInt in that it is a functional replacement for a scaled integer.

It is meant to replicate the fixed point types proposed in ISO/IEC JTC1 SC22 WG14 N1169. The class carries info about the fixed point type's width, sign, scale, and saturation, and provides different operations that would normally be performed on fixed point types.

Semantically this does not represent any existing C type other than fixed point types and should eventually be moved to LLVM if fixed point types gain native IR support.

Definition at line 74 of file FixedPoint.h.

Constructor & Destructor Documentation

◆ APFixedPoint() [1/2]

clang::APFixedPoint::APFixedPoint ( const llvm::APInt &  Val,
const FixedPointSemantics Sema 
)
inline

Definition at line 76 of file FixedPoint.h.

References clang::FixedPointSemantics::getWidth().

Referenced by convert(), getMax(), and getMin().

◆ APFixedPoint() [2/2]

clang::APFixedPoint::APFixedPoint ( uint64_t  Val,
const FixedPointSemantics Sema 
)
inline

Definition at line 82 of file FixedPoint.h.

Member Function Documentation

◆ compare()

int clang::APFixedPoint::compare ( const APFixedPoint Other) const

Definition at line 51 of file FixedPoint.cpp.

References getScale(), getValue(), and max().

◆ convert()

APFixedPoint clang::APFixedPoint::convert ( const FixedPointSemantics DstSema) const

◆ getIntPart()

llvm::APSInt clang::APFixedPoint::getIntPart ( ) const
inline

Definition at line 104 of file FixedPoint.h.

References compare(), and clang::FixedPointSemantics::getScale().

◆ getMax()

APFixedPoint clang::APFixedPoint::getMax ( const FixedPointSemantics Sema)
static

◆ getMin()

APFixedPoint clang::APFixedPoint::getMin ( const FixedPointSemantics Sema)
static

◆ getScale()

unsigned clang::APFixedPoint::getScale ( ) const
inline

Definition at line 88 of file FixedPoint.h.

Referenced by compare(), and convert().

◆ getValue()

llvm::APSInt clang::APFixedPoint::getValue ( ) const
inline

Definition at line 86 of file FixedPoint.h.

Referenced by compare().

◆ getWidth()

unsigned clang::APFixedPoint::getWidth ( ) const
inline

Definition at line 87 of file FixedPoint.h.

◆ hasPadding()

bool clang::APFixedPoint::hasPadding ( ) const
inline

Definition at line 91 of file FixedPoint.h.

◆ isSaturated()

bool clang::APFixedPoint::isSaturated ( ) const
inline

Definition at line 89 of file FixedPoint.h.

◆ isSigned()

bool clang::APFixedPoint::isSigned ( ) const
inline

Definition at line 90 of file FixedPoint.h.

◆ operator!=()

bool clang::APFixedPoint::operator!= ( const APFixedPoint Other) const
inline

Definition at line 116 of file FixedPoint.h.

References compare().

◆ operator<()

bool clang::APFixedPoint::operator< ( const APFixedPoint Other) const
inline

Definition at line 120 of file FixedPoint.h.

References compare().

◆ operator<=()

bool clang::APFixedPoint::operator<= ( const APFixedPoint Other) const
inline

Definition at line 124 of file FixedPoint.h.

References compare().

◆ operator==()

bool clang::APFixedPoint::operator== ( const APFixedPoint Other) const
inline

Definition at line 113 of file FixedPoint.h.

References compare().

◆ operator>()

bool clang::APFixedPoint::operator> ( const APFixedPoint Other) const
inline

Definition at line 119 of file FixedPoint.h.

References compare().

◆ operator>=()

bool clang::APFixedPoint::operator>= ( const APFixedPoint Other) const
inline

Definition at line 121 of file FixedPoint.h.

References compare().

◆ shl()

APFixedPoint clang::APFixedPoint::shl ( unsigned  Amt) const
inline

Definition at line 100 of file FixedPoint.h.

◆ shr()

APFixedPoint clang::APFixedPoint::shr ( unsigned  Amt) const
inline

Definition at line 96 of file FixedPoint.h.


The documentation for this class was generated from the following files: