-
Notifications
You must be signed in to change notification settings - Fork 15k
[Support] Modernize Uint24 in DataExtractor.h (NFC) #165118
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Support] Modernize Uint24 in DataExtractor.h (NFC) #165118
Conversation
We can use brace initializer lists to simplify constructors.
|
@llvm/pr-subscribers-llvm-support Author: Kazu Hirata (kazutakahirata) ChangesWe can use brace initializer lists to simplify constructors. Full diff: https://github.com/llvm/llvm-project/pull/165118.diff 1 Files Affected:
diff --git a/llvm/include/llvm/Support/DataExtractor.h b/llvm/include/llvm/Support/DataExtractor.h
index 3792f53407dd9..f1710b918ce78 100644
--- a/llvm/include/llvm/Support/DataExtractor.h
+++ b/llvm/include/llvm/Support/DataExtractor.h
@@ -19,12 +19,8 @@ namespace llvm {
/// An auxiliary type to facilitate extraction of 3-byte entities.
struct Uint24 {
uint8_t Bytes[3];
- Uint24(uint8_t U) {
- Bytes[0] = Bytes[1] = Bytes[2] = U;
- }
- Uint24(uint8_t U0, uint8_t U1, uint8_t U2) {
- Bytes[0] = U0; Bytes[1] = U1; Bytes[2] = U2;
- }
+ Uint24(uint8_t U) : Bytes{U, U, U} {}
+ Uint24(uint8_t U0, uint8_t U1, uint8_t U2) : Bytes{U0, U1, U2} {}
uint32_t getAsUint32(bool IsLittleEndian) const {
int LoIx = IsLittleEndian ? 0 : 2;
return Bytes[LoIx] + (Bytes[1] << 8) + (Bytes[2-LoIx] << 16);
|
|
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/186/builds/13461 Here is the relevant piece of the build log for the reference |
We can use brace initializer lists to simplify constructors.
We can use brace initializer lists to simplify constructors.
We can use brace initializer lists to simplify constructors.
We can use brace initializer lists to simplify constructors.