aboutsummaryrefslogtreecommitdiff
path: root/src/cube_portable.h
diff options
context:
space:
mode:
authorSebastiano Tronto <sebastiano@tronto.net>2024-05-27 12:04:53 +0200
committerSebastiano Tronto <sebastiano@tronto.net>2024-05-27 12:04:53 +0200
commit49b9c4a516f72e03d53277075f4580e2df8f0e63 (patch)
treedea68649391d14d63a96e742b450c59681ac4305 /src/cube_portable.h
parentfde8dfa9df8df1e3d42a9a8840836e33817cd498 (diff)
downloadnissy-core-49b9c4a516f72e03d53277075f4580e2df8f0e63.tar.gz
nissy-core-49b9c4a516f72e03d53277075f4580e2df8f0e63.zip
Some type fixes and some cleanup
Diffstat (limited to 'src/cube_portable.h')
-rw-r--r--src/cube_portable.h17
1 files changed, 8 insertions, 9 deletions
diff --git a/src/cube_portable.h b/src/cube_portable.h
index d62661a..2999d8a 100644
--- a/src/cube_portable.h
+++ b/src/cube_portable.h
@@ -143,7 +143,7 @@ compose_corners_inplace(cube_fast_t c1, cube_fast_t c2, cube_fast_t *ret)
143 p = piece2 & _pbits; 143 p = piece2 & _pbits;
144 piece1 = c1.corner[p]; 144 piece1 = c1.corner[p];
145 aux = (piece2 & _cobits) + (piece1 & _cobits); 145 aux = (piece2 & _cobits) + (piece1 & _cobits);
146 auy = (aux + _ctwist_cw) >> 2U; 146 auy = (aux + _ctwist_cw) >> 2;
147 orien = (aux + auy) & _cobits2; 147 orien = (aux + auy) & _cobits2;
148 ret->corner[i] = (piece1 & _pbits) | orien; 148 ret->corner[i] = (piece1 & _pbits) | orien;
149 } 149 }
@@ -206,7 +206,7 @@ coord_fast_csep(cube_fast_t c)
206 int64_t ret; 206 int64_t ret;
207 207
208 for (ret = 0, i = 0, p = 1; i < 7; i++, p *= 2) 208 for (ret = 0, i = 0, p = 1; i < 7; i++, p *= 2)
209 ret += p * ((c.corner[i] & _csepbit) >> 2U); 209 ret += p * ((c.corner[i] & _csepbit) >> 2);
210 210
211 return ret; 211 return ret;
212} 212}
@@ -249,8 +249,8 @@ coord_fast_esep(cube_fast_t c)
249 } 249 }
250 */ 250 */
251 251
252 bit1 = (c.edge[i] & _esepbit1) >> 2U; 252 bit1 = (c.edge[i] & _esepbit1) >> 2;
253 bit2 = (c.edge[i] & _esepbit2) >> 3U; 253 bit2 = (c.edge[i] & _esepbit2) >> 3;
254 is1 = (1 - bit2) * bit1; 254 is1 = (1 - bit2) * bit1;
255 255
256 ret1 += bit2 * binomial[11-i][k]; 256 ret1 += bit2 * binomial[11-i][k];
@@ -280,22 +280,21 @@ copy_edges_fast(cube_fast_t *dest, cube_fast_t src)
280_static_inline void 280_static_inline void
281set_eo_fast(cube_fast_t *cube, int64_t eo) 281set_eo_fast(cube_fast_t *cube, int64_t eo)
282{ 282{
283 int i, sum, flip; 283 uint8_t i, sum, flip;
284 284
285 for (sum = 0, i = 1; i < 12; i++, eo >>= 1) { 285 for (sum = 0, i = 1; i < 12; i++, eo >>= 1) {
286 flip = eo % 2; 286 flip = eo % 2;
287 sum += flip; 287 sum += flip;
288 cube->edge[i] = (cube->edge[i] & ~_eobit) | (_eobit * flip); 288 cube->edge[i] = (cube->edge[i] & ~_eobit) | (_eobit * flip);
289 } 289 }
290 cube->edge[0] = (cube->edge[0] & ~_eobit) | (_eobit * (sum%2)); 290 cube->edge[0] = (cube->edge[0] & ~_eobit) | (_eobit * (sum % 2));
291} 291}
292 292
293_static_inline cube_fast_t 293_static_inline cube_fast_t
294invcoord_fast_esep(int64_t esep) 294invcoord_fast_esep(int64_t esep)
295{ 295{
296 cube_fast_t ret; 296 cube_fast_t ret;
297 int64_t i, j, jj, k, l, s, v, w, is1, set1, set2; 297 int64_t bit1, bit2, i, j, jj, k, l, s, v, w, is1, set1, set2;
298 uint8_t bit2, bit1;
299 uint8_t slice[3] = {0}; 298 uint8_t slice[3] = {0};
300 299
301 ret = cubetofast(solved); 300 ret = cubetofast(solved);
@@ -317,7 +316,7 @@ invcoord_fast_esep(int64_t esep)
317 j += (1-bit2); 316 j += (1-bit2);
318 s = 2*bit2 + (1-bit2)*bit1; 317 s = 2*bit2 + (1-bit2)*bit1;
319 318
320 ret.edge[i] = (slice[s]++) | (s << 2); 319 ret.edge[i] = (slice[s]++) | (uint8_t)(s << 2);
321 } 320 }
322 321
323 return ret; 322 return ret;

Generated with cgit - Back to sebastiano.tronto.net