OpenQMC API
Loading...
Searching...
No Matches
rotate.h
Go to the documentation of this file.
1// SPDX-License-Identifier: Apache-2.0
2// Copyright Contributors to the OpenQMC Project.
3
7
8#pragma once
9
10#include "gpu.h"
11
12#include <cstdint>
13
14namespace oqmc
15{
16
26OQMC_HOST_DEVICE constexpr std::uint32_t rotateBits(std::uint32_t value,
27 std::uint32_t distance)
28{
29 return value >> (+distance & 31) | value << (-distance & 31);
30}
31
41OQMC_HOST_DEVICE constexpr std::uint32_t rotateBytes(std::uint32_t value,
42 int distance)
43{
44 return rotateBits(value, distance * 8);
45}
46
47} // namespace oqmc
#define OQMC_HOST_DEVICE
Definition gpu.h:13
constexpr std::uint32_t rotateBytes(std::uint32_t value, int distance)
Rotate bytes in an integer value.
Definition rotate.h:41
EncodeKey decodeBits16(std::uint16_t value)
Decode a value back into a key.
Definition encode.h:81
constexpr std::uint32_t rotateBits(std::uint32_t value, std::uint32_t distance)
Rotate bits in an integer value.
Definition rotate.h:26
Definition bntables.h:21