Skip to content

Commit a34827e

Browse files
committed
Fixed failing test, fixed formatting and cleaned up code
1 parent 33d5a5b commit a34827e

File tree

3 files changed

+13
-14
lines changed

3 files changed

+13
-14
lines changed

source/compiler-core/slang-lexer.cpp

+5-2
Original file line numberDiff line numberDiff line change
@@ -673,7 +673,10 @@ static int _readOptionalBase(char const** ioCursor)
673673
}
674674

675675

676-
IntegerLiteralValue getIntegerLiteralValue(Token const& token, UnownedStringSlice* outSuffix, bool* outIsDecimalBase)
676+
IntegerLiteralValue getIntegerLiteralValue(
677+
Token const& token,
678+
UnownedStringSlice* outSuffix,
679+
bool* outIsDecimalBase)
677680
{
678681
IntegerLiteralValue value = 0;
679682

@@ -698,7 +701,7 @@ IntegerLiteralValue getIntegerLiteralValue(Token const& token, UnownedStringSlic
698701
*outSuffix = UnownedStringSlice(cursor, end);
699702
}
700703

701-
if(outIsDecimalBase)
704+
if (outIsDecimalBase)
702705
{
703706
*outIsDecimalBase = (base == 10);
704707
}

source/slang/slang-parser.cpp

+7-11
Original file line numberDiff line numberDiff line change
@@ -6679,20 +6679,16 @@ static BaseType _determineNonSuffixedIntegerLiteralType(
66796679
if (isDecimalBase)
66806680
{
66816681
// There is an edge case here where 9223372036854775808 or INT64_MAX + 1
6682-
// brings us here, but the complete literal is -9223372036854775808 or INT64_MIN and is valid.
6683-
// Unfortunately because the lexer handles the negative(-) part of the literal separately
6684-
// it is impossible to know whether the literal has a negative sign or not.
6685-
// We emit the warning and initially process it as a uint64 anyways, and the negative sign
6686-
// will be properly parsed and the value will still be properly stored as a negative INT64_MIN.
6682+
// brings us here, but the complete literal is -9223372036854775808 or INT64_MIN and is
6683+
// valid. Unfortunately because the lexer handles the negative(-) part of the literal
6684+
// separately it is impossible to know whether the literal has a negative sign or not.
6685+
// We emit the warning and initially process it as a uint64 anyways, and the negative
6686+
// sign will be properly parsed and the value will still be properly stored as a
6687+
// negative INT64_MIN.
66876688

66886689
// Decimal integer is too large to be represented as signed.
66896690
// Output warning that it is represented as unsigned instead.
6690-
sink->diagnose(
6691-
*token,
6692-
Diagnostics::integerLiteralTooLarge,
6693-
token->getContent(),
6694-
BaseTypeInfo::asText(baseType),
6695-
rawValue);
6691+
sink->diagnose(*token, Diagnostics::integerLiteralTooLarge);
66966692
}
66976693
}
66986694

tests/slang-extension/atomic-int64-byte-address-buffer.slang

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,6 @@ void computeMain(int3 dispatchThreadID : SV_DispatchThreadID)
3232
// Bit logical
3333
outputBuffer.InterlockedOrU64((idx << 3), (uint64_t(2) << 32) | (tid << 4));
3434
outputBuffer.InterlockedXorU64((idx << 3), tid << 8);
35-
outputBuffer.InterlockedAndU64((idx << 3), (uint64_t(tid | 2) << 32) | 0xffffffff);
35+
outputBuffer.InterlockedAndU64((idx << 3), (uint64_t(tid | 2) << 32) | 0xffffffffffffffff);
3636
}
3737

0 commit comments

Comments
 (0)