summaryrefslogtreecommitdiff
path: root/lib/cvthex.c
diff options
context:
space:
mode:
authorFreya Murphy <freya@freyacat.org>2025-03-27 11:39:12 -0400
committerFreya Murphy <freya@freyacat.org>2025-03-27 11:39:12 -0400
commit0ff301cda68669c59351e5854ce98f2cf460543f (patch)
treecfe8f976261962420ada64b821559b9da0a56841 /lib/cvthex.c
parentadd compile_flags.txt for clangd lsp (diff)
downloadcomus-0ff301cda68669c59351e5854ce98f2cf460543f.tar.gz
comus-0ff301cda68669c59351e5854ce98f2cf460543f.tar.bz2
comus-0ff301cda68669c59351e5854ce98f2cf460543f.zip
pull upstream changes, add auto formatting
Diffstat (limited to 'lib/cvthex.c')
-rw-r--r--lib/cvthex.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/lib/cvthex.c b/lib/cvthex.c
index 5f3da19..8faf853 100644
--- a/lib/cvthex.c
+++ b/lib/cvthex.c
@@ -27,13 +27,14 @@
**
** NOTE: assumes buf is large enough to hold the resulting string
*/
-int cvthex( char *buf, uint32_t value ) {
+int cvthex(char *buf, uint32_t value)
+{
const char hexdigits[] = "0123456789ABCDEF";
int chars_stored = 0;
- for( int i = 0; i < 8; i += 1 ) {
+ for (int i = 0; i < 8; i += 1) {
uint32_t val = value & 0xf0000000;
- if( chars_stored || val != 0 || i == 7 ) {
+ if (chars_stored || val != 0 || i == 7) {
++chars_stored;
val = (val >> 28) & 0xf;
*buf++ = hexdigits[val];
@@ -43,7 +44,7 @@ int cvthex( char *buf, uint32_t value ) {
*buf = '\0';
- return( chars_stored );
+ return (chars_stored);
}
#endif