Skip to content

Commit b507dba

Browse files
committed
review: add explicit comment of how the float is handled
1 parent e60ec79 commit b507dba

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

clang/include/clang/Parse/ParseHLSLRootSignature.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,14 @@ class RootSignatureParser {
134134
/// 32-bit integer
135135
std::optional<int32_t> handleIntLiteral(bool Negated);
136136
/// Use NumericLiteralParser to convert CurToken.NumSpelling into a float
137+
///
138+
/// This matches the behaviour of DXC, which is as follows:
139+
/// - convert the spelling with `strtod`
140+
/// - check for a float overflow
141+
/// - cast the double to a float
142+
/// The behaviour of `strtod` is replicated using:
143+
/// Semantics: llvm::APFloat::Semantics::S_IEEEdouble
144+
/// RoundingMode: llvm::RoundingMode::NearestTiesToEven
137145
std::optional<float> handleFloatLiteral(bool Negated);
138146

139147
/// Flags may specify the value of '0' to denote that there should be no

0 commit comments

Comments
 (0)