Skip to content

Commit c6ce78f

Browse files
kazutakahiratagithub-actions[bot]
authored andcommitted
Automerge: [Support] Modernize Uint24 in DataExtractor.h (NFC) (#165118)
We can use brace initializer lists to simplify constructors.
2 parents 1625303 + e219cf6 commit c6ce78f

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

llvm/include/llvm/Support/DataExtractor.h

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,8 @@ namespace llvm {
1919
/// An auxiliary type to facilitate extraction of 3-byte entities.
2020
struct Uint24 {
2121
uint8_t Bytes[3];
22-
Uint24(uint8_t U) {
23-
Bytes[0] = Bytes[1] = Bytes[2] = U;
24-
}
25-
Uint24(uint8_t U0, uint8_t U1, uint8_t U2) {
26-
Bytes[0] = U0; Bytes[1] = U1; Bytes[2] = U2;
27-
}
22+
Uint24(uint8_t U) : Bytes{U, U, U} {}
23+
Uint24(uint8_t U0, uint8_t U1, uint8_t U2) : Bytes{U0, U1, U2} {}
2824
uint32_t getAsUint32(bool IsLittleEndian) const {
2925
int LoIx = IsLittleEndian ? 0 : 2;
3026
return Bytes[LoIx] + (Bytes[1] << 8) + (Bytes[2-LoIx] << 16);

0 commit comments

Comments
 (0)