diff options
author | AbigailBuccaneer <AbigailBuccaneer@users.noreply.github.com> | 2020-08-24 18:04:37 +0100 |
---|---|---|
committer | AbigailBuccaneer <AbigailBuccaneer@users.noreply.github.com> | 2020-08-24 18:52:08 +0100 |
commit | 6995a2e1bac6812ec4f48b98cfaf321f75c320d8 (patch) | |
tree | e185dbb951524cc11ab33af90ddb20d412e92733 /buildconfig/BuildConfig.h | |
parent | 0f2757f0004e20503b2c4ee587e16f6775ee14bf (diff) | |
download | PrismLauncher-6995a2e1bac6812ec4f48b98cfaf321f75c320d8.tar.gz PrismLauncher-6995a2e1bac6812ec4f48b98cfaf321f75c320d8.tar.bz2 PrismLauncher-6995a2e1bac6812ec4f48b98cfaf321f75c320d8.zip |
Avoid undefined behaviour when byteswapping
`a << b` is undefined when `a` is negative, and `a >> b` is
implementation-defined. The correct thing to do here is to cast to
unsigned, swap the bytes there and then swap back.
This also improves performance on some compilers: Clang is smart enough
to recognise that we're byteswapping here and reduce it to a single
`bswap` instruction on x86_64, but only for the unsigned versions.
Diffstat (limited to 'buildconfig/BuildConfig.h')
0 files changed, 0 insertions, 0 deletions