diff options
| author | Sebastiano Tronto <sebastiano@tronto.net> | 2024-06-10 19:26:47 +0200 |
|---|---|---|
| committer | Sebastiano Tronto <sebastiano@tronto.net> | 2024-06-10 19:26:47 +0200 |
| commit | 832ad3dcf3818e57c53304ea9b09a943e785a16b (patch) | |
| tree | db78b51e3eee74d293b38337eeb1a02e33c5aed6 /src/io_cube.h | |
| parent | 1cecea625ed405c7203d1977e687da36d835fc9a (diff) | |
| download | nissy-core-832ad3dcf3818e57c53304ea9b09a943e785a16b.tar.gz nissy-core-832ad3dcf3818e57c53304ea9b09a943e785a16b.zip | |
Added tests for B32
Diffstat (limited to 'src/io_cube.h')
| -rw-r--r-- | src/io_cube.h | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/io_cube.h b/src/io_cube.h index 63c9f53..430d3ac 100644 --- a/src/io_cube.h +++ b/src/io_cube.h | |||
| @@ -324,17 +324,17 @@ writecube_LST(cube_t cube, char *buf) | |||
| 324 | _static uint8_t | 324 | _static uint8_t |
| 325 | b32toedge(char c) | 325 | b32toedge(char c) |
| 326 | { | 326 | { |
| 327 | if ((c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'g')) | 327 | if (!((c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'f'))) |
| 328 | return 255; | 328 | return 255; |
| 329 | 329 | ||
| 330 | return c <= 'Z' ? (uint8_t)(c - 'A') : (uint8_t)(c - 'a'); | 330 | return c <= 'Z' ? (uint8_t)(c - 'A') : (uint8_t)(c - 'a') + 26; |
| 331 | } | 331 | } |
| 332 | 332 | ||
| 333 | _static uint8_t | 333 | _static uint8_t |
| 334 | b32tocorner(char c) { | 334 | b32tocorner(char c) { |
| 335 | uint8_t val; | 335 | uint8_t val; |
| 336 | 336 | ||
| 337 | if ((c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'g')) | 337 | if (!((c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'f'))) |
| 338 | return 255; | 338 | return 255; |
| 339 | 339 | ||
| 340 | val = c <= 'Z' ? (uint8_t)(c - 'A') : (uint8_t)(c - 'a') + 26; | 340 | val = c <= 'Z' ? (uint8_t)(c - 'A') : (uint8_t)(c - 'a') + 26; |
| @@ -345,7 +345,7 @@ b32tocorner(char c) { | |||
| 345 | _static char | 345 | _static char |
| 346 | edgetob32(uint8_t edge) | 346 | edgetob32(uint8_t edge) |
| 347 | { | 347 | { |
| 348 | return edge <= 26 ? 'A' + (char)edge : 'a' + (char)(edge - 26); | 348 | return edge < 26 ? 'A' + (char)edge : 'a' + (char)(edge - 26); |
| 349 | } | 349 | } |
| 350 | 350 | ||
| 351 | _static char | 351 | _static char |
| @@ -355,5 +355,5 @@ cornertob32(uint8_t corner) | |||
| 355 | 355 | ||
| 356 | val = (corner & 7) | ((corner & 96) >> 2); | 356 | val = (corner & 7) | ((corner & 96) >> 2); |
| 357 | 357 | ||
| 358 | return val <= 26 ? 'A' + (char)val : 'a' + (char)(val - 26); | 358 | return val < 26 ? 'A' + (char)val : 'a' + (char)(val - 26); |
| 359 | } | 359 | } |
