cuDDL
Loading...
Searching...
No Matches
dna.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <cuda/std/cstdint>
4
5
6namespace cuddl::detail {
7
13#ifdef __CUDACC__
14__host__ __device__
15#endif
16inline constexpr uint8_t encode_base(char base) noexcept {
17 auto const byte = static_cast<uint8_t>(base);
18 auto const upper = static_cast<uint8_t>(byte & 0xDFu);
19 auto const x = (byte >> 1u) & 3u;
20 auto const valid =
21 static_cast<uint8_t>((upper == 'A') | (upper == 'C') | (upper == 'G') | (upper == 'T'));
22 auto const mask = static_cast<uint8_t>(0u - valid);
23 return static_cast<uint8_t>((x & mask) | (0xFFu & ~mask));
24}
25
27inline constexpr uint32_t missing_cell = 0x00FFFFFFU;
28
29} // namespace cuddl::detail
constexpr uint32_t missing_cell
Eight ambiguous bases: an encoder cell past the end of a sequence.
Definition dna.hpp:27
constexpr uint8_t encode_base(char base) noexcept
Maps one DNA byte to its 2-bit symbol (A=0, C=1, T=2, G=3) or 0xff when invalid.
Definition dna.hpp:16