Skip to content

Commit 0a8d228

Browse files
committed
review: small clarifications
- use MapT instead of IMap - use ~0u for conciseness
1 parent d5c8899 commit 0a8d228

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

llvm/include/llvm/Frontend/HLSL/HLSLRootSignatureUtils.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,22 +63,22 @@ class MetadataBuilder {
6363
// RangeInfo holds the information to correctly construct a ResourceRange
6464
// and retains this information to be used for displaying a better diagnostic
6565
struct RangeInfo {
66-
const static uint32_t Unbounded = static_cast<uint32_t>(-1);
66+
const static uint32_t Unbounded = ~0u;
6767

6868
uint32_t LowerBound;
6969
uint32_t UpperBound;
7070
};
7171

7272
class ResourceRange {
7373
public:
74-
using IMap = llvm::IntervalMap<uint32_t, const RangeInfo *, 16,
74+
using MapT = llvm::IntervalMap<uint32_t, const RangeInfo *, 16,
7575
llvm::IntervalMapInfo<uint32_t>>;
7676

7777
private:
78-
IMap Intervals;
78+
MapT Intervals;
7979

8080
public:
81-
ResourceRange(IMap::Allocator &Allocator) : Intervals(IMap(Allocator)) {}
81+
ResourceRange(MapT::Allocator &Allocator) : Intervals(MapT(Allocator)) {}
8282

8383
// Returns a reference to the first RangeInfo that overlaps with
8484
// [Info.LowerBound;Info.UpperBound], or, std::nullopt if there is no overlap

llvm/lib/Frontend/HLSL/HLSLRootSignatureUtils.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -324,7 +324,7 @@ MDNode *MetadataBuilder::BuildStaticSampler(const StaticSampler &Sampler) {
324324

325325
std::optional<const RangeInfo *>
326326
ResourceRange::getOverlapping(const RangeInfo &Info) const {
327-
IMap::const_iterator Interval = Intervals.find(Info.LowerBound);
327+
MapT::const_iterator Interval = Intervals.find(Info.LowerBound);
328328
if (!Interval.valid() || Info.UpperBound < Interval.start())
329329
return std::nullopt;
330330
return Interval.value();
@@ -339,7 +339,7 @@ std::optional<const RangeInfo *> ResourceRange::insert(const RangeInfo &Info) {
339339
uint32_t UpperBound = Info.UpperBound;
340340

341341
std::optional<const RangeInfo *> Res = std::nullopt;
342-
IMap::iterator Interval = Intervals.begin();
342+
MapT::iterator Interval = Intervals.begin();
343343

344344
while (true) {
345345
if (UpperBound < LowerBound)

0 commit comments

Comments
 (0)