[all-commits] [llvm/llvm-project] 51d85b: [Support] Add llvm::support::endian::writeNext (#8...

Fangrui Song via All-commits all-commits at lists.llvm.org
Mon Apr 15 10:02:44 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 51d85b7b107e9508b90cec274f3f122444fe7ee6
      https://github.com/llvm/llvm-project/commit/51d85b7b107e9508b90cec274f3f122444fe7ee6
  Author: Fangrui Song <i at maskray.me>
  Date:   2024-04-15 (Mon, 15 Apr 2024)

  Changed paths:
    M llvm/include/llvm/Support/Endian.h
    M llvm/unittests/Support/EndianTest.cpp

  Log Message:
  -----------
  [Support] Add llvm::support::endian::writeNext (#88685)

`writeNext` overloads increase the pointer argument like `readNext`.
Code like the following
```
endian::write32<ELFT::Endianness>(p, 42);
p += 4;
endian::write32<ELFT::Endianness>(p, 43);
p += 4;
```

can be simplified to:
```
endian::writeNext<uint32_t, ELFT::Endianness>(p, 42);
endian::writeNext<uint32_t, ELFT::Endianness>(p, 43);
```



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list