Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
fixup! src: simplify alignment-handling code
  • Loading branch information
addaleax committed Jun 14, 2020
commit 38cf024eda3045dd1d2a9145e6d6445dc3d94663
6 changes: 3 additions & 3 deletions src/util-inl.h
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ void SwapBytes16(char* data, size_t nbytes) {
CHECK_EQ(nbytes % 2, 0);

#if defined(_MSC_VER)
if (AlignUp(data, sizeof(uint16_t) == data) {
if (AlignUp(data, sizeof(uint16_t)) == data) {
// MSVC has no strict aliasing, and is able to highly optimize this case.
uint16_t* data16 = reinterpret_cast<uint16_t*>(data);
size_t len16 = nbytes / sizeof(*data16);
Expand All @@ -232,7 +232,7 @@ void SwapBytes32(char* data, size_t nbytes) {

#if defined(_MSC_VER)
// MSVC has no strict aliasing, and is able to highly optimize this case.
if (AlignUp(data, sizeof(uint32_t) == data) {
if (AlignUp(data, sizeof(uint32_t)) == data) {
uint32_t* data32 = reinterpret_cast<uint32_t*>(data);
size_t len32 = nbytes / sizeof(*data32);
for (size_t i = 0; i < len32; i++) {
Expand All @@ -254,7 +254,7 @@ void SwapBytes64(char* data, size_t nbytes) {
CHECK_EQ(nbytes % 8, 0);

#if defined(_MSC_VER)
if (AlignUp(data, sizeof(uint64_t) == data) {
if (AlignUp(data, sizeof(uint64_t)) == data) {
// MSVC has no strict aliasing, and is able to highly optimize this case.
uint64_t* data64 = reinterpret_cast<uint64_t*>(data);
size_t len64 = nbytes / sizeof(*data64);
Expand Down