Skip to content

Commit 3b7091b

Browse files
authored
[APFloat] add predicates to fltSemantics for hasZero and hasSignedRepr (llvm#111451)
We add static methods to APFloatBase to allow the hasZero and hasSignedRepr properties of fltSemantics to be obtained.
1 parent 3b2bfb4 commit 3b7091b

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

llvm/include/llvm/ADT/APFloat.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -309,6 +309,8 @@ struct APFloatBase {
309309
static ExponentType semanticsMaxExponent(const fltSemantics &);
310310
static unsigned int semanticsSizeInBits(const fltSemantics &);
311311
static unsigned int semanticsIntSizeInBits(const fltSemantics&, bool);
312+
static bool semanticsHasZero(const fltSemantics &);
313+
static bool semanticsHasSignedRepr(const fltSemantics &);
312314

313315
// Returns true if any number described by \p Src can be precisely represented
314316
// by a normal (not subnormal) value in \p Dst.

llvm/lib/Support/APFloat.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -367,6 +367,14 @@ unsigned int APFloatBase::semanticsIntSizeInBits(const fltSemantics &semantics,
367367
return MinBitWidth;
368368
}
369369

370+
bool APFloatBase::semanticsHasZero(const fltSemantics &semantics) {
371+
return semantics.hasZero;
372+
}
373+
374+
bool APFloatBase::semanticsHasSignedRepr(const fltSemantics &semantics) {
375+
return semantics.hasSignedRepr;
376+
}
377+
370378
bool APFloatBase::isRepresentableAsNormalIn(const fltSemantics &Src,
371379
const fltSemantics &Dst) {
372380
// Exponent range must be larger.

0 commit comments

Comments
 (0)