From 63646e8906e062d1c1de3925cba70c4e3426a855 Mon Sep 17 00:00:00 2001 From: QMK Bot Date: Sat, 12 Feb 2022 10:29:31 -0800 Subject: Format code according to conventions (#16322) --- tmk_core/protocol/arm_atsam/usb/usb_util.c | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) (limited to 'tmk_core/protocol/arm_atsam/usb/usb_util.c') diff --git a/tmk_core/protocol/arm_atsam/usb/usb_util.c b/tmk_core/protocol/arm_atsam/usb/usb_util.c index a682c00b58..c7555c84c6 100644 --- a/tmk_core/protocol/arm_atsam/usb/usb_util.c +++ b/tmk_core/protocol/arm_atsam/usb/usb_util.c @@ -11,17 +11,17 @@ char digit(int d, int radix) { } int UTIL_ltoa_radix(int64_t value, char *dest, int radix) { - int64_t original = value; // save original value + int64_t original = value; // save original value char buf[25] = ""; int c = sizeof(buf) - 1; int last = c; int d; int size; - if (value < 0) // if it's negative, take the absolute value + if (value < 0) // if it's negative, take the absolute value value = -value; - do // write least significant digit of value that's left + do // write least significant digit of value that's left { d = (value % radix); buf[--c] = digit(d, radix); @@ -30,14 +30,20 @@ int UTIL_ltoa_radix(int64_t value, char *dest, int radix) { if (original < 0) buf[--c] = '-'; - size = last - c + 1; // includes null at end + size = last - c + 1; // includes null at end memcpy(dest, &buf[c], last - c + 1); - return (size - 1); // without null termination + return (size - 1); // without null termination } -int UTIL_ltoa(int64_t value, char *dest) { return UTIL_ltoa_radix(value, dest, 10); } +int UTIL_ltoa(int64_t value, char *dest) { + return UTIL_ltoa_radix(value, dest, 10); +} -int UTIL_itoa(int value, char *dest) { return UTIL_ltoa_radix((int64_t)value, dest, 10); } +int UTIL_itoa(int value, char *dest) { + return UTIL_ltoa_radix((int64_t)value, dest, 10); +} -int UTIL_utoa(uint32_t value, char *dest) { return UTIL_ltoa_radix((int64_t)value, dest, 10); } +int UTIL_utoa(uint32_t value, char *dest) { + return UTIL_ltoa_radix((int64_t)value, dest, 10); +} -- cgit v1.2.3