diff options
| author | Sebastiano Tronto <sebastiano@tronto.net> | 2025-07-29 12:12:43 +0200 |
|---|---|---|
| committer | Sebastiano Tronto <sebastiano@tronto.net> | 2025-07-29 12:12:43 +0200 |
| commit | ea0387796a349c91032fbcb10f50c6ad8607b0f6 (patch) | |
| tree | aed484690d24c0c28c7695d4b5389f2e3c341b96 /src/solvers/h48/coordinate.h | |
| parent | 52c21640508c3fc668107778ae027ff4428ebd89 (diff) | |
| download | nissy-core-ea0387796a349c91032fbcb10f50c6ad8607b0f6.tar.gz nissy-core-ea0387796a349c91032fbcb10f50c6ad8607b0f6.zip | |
All coordinates unsigned
Diffstat (limited to 'src/solvers/h48/coordinate.h')
| -rw-r--r-- | src/solvers/h48/coordinate.h | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/src/solvers/h48/coordinate.h b/src/solvers/h48/coordinate.h index 9437fa7..a7f0087 100644 --- a/src/solvers/h48/coordinate.h +++ b/src/solvers/h48/coordinate.h | |||
| @@ -1,17 +1,17 @@ | |||
| 1 | STATIC_INLINE int64_t coord_h48( | 1 | STATIC_INLINE uint64_t coord_h48( |
| 2 | cube_t, const uint32_t [static COCSEP_TABLESIZE], uint8_t); | 2 | cube_t, const uint32_t [static COCSEP_TABLESIZE], uint8_t); |
| 3 | STATIC_INLINE int64_t coord_h48_edges(cube_t, int64_t, uint8_t, uint8_t); | 3 | STATIC_INLINE uint64_t coord_h48_edges(cube_t, uint64_t, uint8_t, uint8_t); |
| 4 | STATIC_INLINE cube_t invcoord_h48( | 4 | STATIC_INLINE cube_t invcoord_h48( |
| 5 | int64_t, const cube_t [static COCSEP_CLASSES], uint8_t); | 5 | uint64_t, const cube_t [static COCSEP_CLASSES], uint8_t); |
| 6 | 6 | ||
| 7 | STATIC_INLINE int64_t | 7 | STATIC_INLINE uint64_t |
| 8 | coord_h48( | 8 | coord_h48( |
| 9 | cube_t c, | 9 | cube_t c, |
| 10 | const uint32_t cocsepdata[static COCSEP_TABLESIZE], | 10 | const uint32_t cocsepdata[static COCSEP_TABLESIZE], |
| 11 | uint8_t h | 11 | uint8_t h |
| 12 | ) | 12 | ) |
| 13 | { | 13 | { |
| 14 | int64_t cocsep, coclass; | 14 | uint64_t cocsep, coclass; |
| 15 | uint32_t data; | 15 | uint32_t data; |
| 16 | uint8_t ttrep; | 16 | uint8_t ttrep; |
| 17 | 17 | ||
| @@ -19,24 +19,24 @@ coord_h48( | |||
| 19 | 19 | ||
| 20 | cocsep = coord_cocsep(c); | 20 | cocsep = coord_cocsep(c); |
| 21 | data = cocsepdata[cocsep]; | 21 | data = cocsepdata[cocsep]; |
| 22 | coclass = (int64_t)COCLASS(data); | 22 | coclass = COCLASS(data); |
| 23 | ttrep = (int64_t)TTREP(data); | 23 | ttrep = TTREP(data); |
| 24 | 24 | ||
| 25 | return coord_h48_edges(c, coclass, ttrep, h); | 25 | return coord_h48_edges(c, coclass, ttrep, h); |
| 26 | } | 26 | } |
| 27 | 27 | ||
| 28 | STATIC_INLINE int64_t | 28 | STATIC_INLINE uint64_t |
| 29 | coord_h48_edges(cube_t c, int64_t coclass, uint8_t ttrep, uint8_t h) | 29 | coord_h48_edges(cube_t c, uint64_t coclass, uint8_t ttrep, uint8_t h) |
| 30 | { | 30 | { |
| 31 | cube_t d; | 31 | cube_t d; |
| 32 | int64_t esep, eo, edges; | 32 | uint64_t esep, eo, edges; |
| 33 | 33 | ||
| 34 | d = transform_edges(c, ttrep); | 34 | d = transform_edges(c, ttrep); |
| 35 | esep = coord_esep(d); | 35 | esep = coord_esep(d); |
| 36 | eo = coord_eo(d); | 36 | eo = coord_eo(d); |
| 37 | edges = (esep << 11) + eo; | 37 | edges = (esep << 11) + eo; |
| 38 | 38 | ||
| 39 | return (coclass * H48_ESIZE(11) + edges) >> (11 - (int64_t)h); | 39 | return (coclass * H48_ESIZE(11) + edges) >> (11 - (uint64_t)h); |
| 40 | } | 40 | } |
| 41 | 41 | ||
| 42 | /* | 42 | /* |
| @@ -46,17 +46,17 @@ returned cube is a transformed cube of one that gives the correct value. | |||
| 46 | */ | 46 | */ |
| 47 | STATIC_INLINE cube_t | 47 | STATIC_INLINE cube_t |
| 48 | invcoord_h48( | 48 | invcoord_h48( |
| 49 | int64_t i, | 49 | uint64_t i, |
| 50 | const cube_t crep[static COCSEP_CLASSES], | 50 | const cube_t crep[static COCSEP_CLASSES], |
| 51 | uint8_t h | 51 | uint8_t h |
| 52 | ) | 52 | ) |
| 53 | { | 53 | { |
| 54 | cube_t ret; | 54 | cube_t ret; |
| 55 | int64_t hh, coclass, ee, esep, eo; | 55 | uint64_t hh, coclass, ee, esep, eo; |
| 56 | 56 | ||
| 57 | DBG_ASSERT(h <= 11, "invcoord_h48: h must be between 0 and 11\n"); | 57 | DBG_ASSERT(h <= 11, "invcoord_h48: h must be between 0 and 11\n"); |
| 58 | 58 | ||
| 59 | hh = (int64_t)h; | 59 | hh = (uint64_t)h; |
| 60 | coclass = i / H48_ESIZE(h); | 60 | coclass = i / H48_ESIZE(h); |
| 61 | ee = i % H48_ESIZE(h); | 61 | ee = i % H48_ESIZE(h); |
| 62 | esep = ee >> hh; | 62 | esep = ee >> hh; |
