[PATCH] D123298: [NFC] [AST] Reduce the size of TemplateParmPosition
Chuanqi Xu via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Apr 11 19:44:09 PDT 2022
ChuanqiXu marked an inline comment as done.
ChuanqiXu added inline comments.
================
Comment at: clang/include/clang/AST/DeclTemplate.h:1156-1157
- TemplateParmPosition(unsigned D, unsigned P) : Depth(D), Position(P) {}
+ static constexpr unsigned MaxDepth = (1l << DEPTH_BITWIDTH) - 1;
+ static constexpr unsigned MaxPosition = (1l << POSITION_BITWIDTH) - 1;
+
----------------
aaron.ballman wrote:
> ChuanqiXu wrote:
> > I don't find standard way to generate the maximum value for bit fields.. So I choose to calculate it by hand.
> Since we're adding 1 everywhere we look at these values, would it make more sense to drop the -1 here and the +1 elsewhere?
Maybe we're able to drop the -1 here. But I feel it breaks the semantics. So I feel it is not good.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D123298/new/
https://reviews.llvm.org/D123298
More information about the cfe-commits
mailing list