diff options
author | Damien George <damien.p.george@gmail.com> | 2020-02-27 15:36:53 +1100 |
---|---|---|
committer | Damien George <damien.p.george@gmail.com> | 2020-02-28 10:33:03 +1100 |
commit | 69661f3343bedf86e514337cff63d96cc42f8859 (patch) | |
tree | af5dfb380ffdb75dda84828f63cf9d840d992f0f /py/formatfloat.c | |
parent | 3f39d18c2b884d32f0443e2e8114ff9d7a14d718 (diff) |
all: Reformat C and Python source code with tools/codeformat.py.
This is run with uncrustify 0.70.1, and black 19.10b0.
Diffstat (limited to 'py/formatfloat.c')
-rw-r--r-- | py/formatfloat.c | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/py/formatfloat.c b/py/formatfloat.c index dc7fc1d1f..50fc0da4b 100644 --- a/py/formatfloat.c +++ b/py/formatfloat.c @@ -68,11 +68,20 @@ union floatbits { float f; uint32_t u; }; -static inline int fp_signbit(float x) { union floatbits fb = {x}; return fb.u & FLT_SIGN_MASK; } +static inline int fp_signbit(float x) { + union floatbits fb = {x}; + return fb.u & FLT_SIGN_MASK; +} #define fp_isnan(x) isnan(x) #define fp_isinf(x) isinf(x) -static inline int fp_iszero(float x) { union floatbits fb = {x}; return fb.u == 0; } -static inline int fp_isless1(float x) { union floatbits fb = {x}; return fb.u < 0x3f800000; } +static inline int fp_iszero(float x) { + union floatbits fb = {x}; + return fb.u == 0; +} +static inline int fp_isless1(float x) { + union floatbits fb = {x}; + return fb.u < 0x3f800000; +} #elif MICROPY_FLOAT_IMPL == MICROPY_FLOAT_IMPL_DOUBLE @@ -282,7 +291,7 @@ int mp_format_float(FPTYPE f, char *buf, size_t buf_size, char fmt, int prec, ch if (fmt == 'e' && prec > (buf_remaining - FPMIN_BUF_SIZE)) { prec = buf_remaining - FPMIN_BUF_SIZE; } - if (fmt == 'g'){ + if (fmt == 'g') { // Truncate precision to prevent buffer overflow if (prec + (FPMIN_BUF_SIZE - 1) > buf_remaining) { prec = buf_remaining - (FPMIN_BUF_SIZE - 1); |