6 #include <dmlc/endian.h>
12 #if defined(xgboost_IS_WIN)
19 #if defined(__CUDA_ARCH__)
22 [[nodiscard]] __device__ T
ByteSwap(T v);
25 inline __device__ std::uint16_t
ByteSwap(std::uint16_t v) {
26 return __nv_bswap16(v);
30 inline __device__ std::uint32_t
ByteSwap(std::uint32_t v) {
31 return __nv_bswap32(v);
35 inline __device__ std::uint64_t
ByteSwap(std::uint64_t v) {
36 return __nv_bswap64(v);
39 #elif defined(__GLIBC__)
45 inline std::uint16_t
ByteSwap(std::uint16_t v) {
46 return __builtin_bswap16(v);
50 inline std::uint32_t
ByteSwap(std::uint32_t v) {
51 return __builtin_bswap32(v);
55 inline std::uint64_t
ByteSwap(std::uint64_t v) {
56 return __builtin_bswap64(v);
59 #elif defined(xgboost_IS_WIN) && !defined(__MINGW32__)
65 inline std::uint16_t
ByteSwap(std::uint16_t v) {
66 return _byteswap_ushort(v);
70 inline std::uint32_t
ByteSwap(std::uint32_t v) {
71 return _byteswap_ulong(v);
75 inline std::uint64_t
ByteSwap(std::uint64_t v) {
76 return _byteswap_uint64(v);
Defines configuration macros and basic types for xgboost.
Learner interface that integrates objective, gbm and evaluation together. This is the user facing XGB...
Definition: base.h:89
T ByteSwap(T v)
Definition: byteswap.h:82