diff options
| author | Ethan Roseman <ethteck@gmail.com> | 2020-03-22 19:21:39 -0400 |
|---|---|---|
| committer | Ethan Roseman <ethteck@gmail.com> | 2020-03-22 19:21:39 -0400 |
| commit | ab976edca4f09dc017a7672596b232e6d2a98e07 (patch) | |
| tree | ce030691b1e00c2e224a0680033834e7043129de /src/libultra_boot_O2/_Litob.c | |
| parent | 0f7cc04f430f0b98b98e51de08a94f2c326ba36e (diff) | |
| parent | d85168f0b088c8e5f661725f45946ca10cc82956 (diff) | |
Merge branch 'master' into ovl_Bg_Gate_Shutter
Diffstat (limited to 'src/libultra_boot_O2/_Litob.c')
| -rw-r--r-- | src/libultra_boot_O2/_Litob.c | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/src/libultra_boot_O2/_Litob.c b/src/libultra_boot_O2/_Litob.c index 15206217c..5b2329cd3 100644 --- a/src/libultra_boot_O2/_Litob.c +++ b/src/libultra_boot_O2/_Litob.c @@ -8,28 +8,31 @@ u8 D_8000AF70[] = "0123456789abcdef"; u8 D_8000AF84[] = "0123456789ABCDEF"; -void _Litob(_Pft *args, u8 type) { +void _Litob(_Pft* args, u8 type) { u8 buff[BUFF_LEN]; - const u8 *num_map; + const u8* num_map; s32 base; s32 buff_ind; u64 num; lldiv_t quotrem; - if (type == 'X') + if (type == 'X') { num_map = D_8000AF84; - else + } else { num_map = D_8000AF70; + } base = (type == 'o') ? 8 : ((type != 'x' && type != 'X') ? 10 : 16); buff_ind = BUFF_LEN; num = args->v.ll; - if ((type == 'd' || type == 'i') && args->v.ll < 0) + if ((type == 'd' || type == 'i') && args->v.ll < 0) { num = -num; + } - if (num != 0 || args->prec != 0) + if (num != 0 || args->prec != 0) { buff[--buff_ind] = num_map[num % base]; + } args->v.ll = num / base; @@ -43,12 +46,14 @@ void _Litob(_Pft *args, u8 type) { memcpy(args->s, buff + buff_ind, args->n1); - if (args->n1 < args->prec) + if (args->n1 < args->prec) { args->nz0 = args->prec - args->n1; + } if (args->prec < 0 && (args->flags & (FLAGS_ZERO | FLAGS_MINUS)) == FLAGS_ZERO) { buff_ind = args->width - args->n0 - args->nz0 - args->n1; - if (buff_ind > 0) + if (buff_ind > 0) { args->nz0 += buff_ind; + } } } |
