IlyaGrebnov / libsais

libsais is a library for linear time suffix array, longest common prefix array and burrows wheeler transform construction based on induced sorting algorithm.
Apache License 2.0
180 stars 22 forks source link

__builtin_bswap16 presence check for (older) GCCs that don't support it #6

Closed tansy closed 2 years ago

tansy commented 2 years ago

__builtin_bswap16(x) is gcc and clang built-in 16-bit byte swap macro. In libsais it is chosen by preprocessor if __GNUC__ or __clang__ are defined but __builtin_bswap16(x) is not present in every gcc even though __GNUC__ is defined. Although as it's been apparently patched in new gcc but it is important to be aware of the fact that checking for __GNUC__ is not sufficient indicator of the built-in presence. Hence the pull request.