From 454b3bb39baeb3bfa6f7f02777004dd77700e426 Mon Sep 17 00:00:00 2001 From: Jaerder Sousa Date: Thu, 19 Mar 2026 21:50:33 +0000 Subject: [PATCH 1/2] added support for %x in snprintfEx --- saturnringlib/srl_string.hpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/saturnringlib/srl_string.hpp b/saturnringlib/srl_string.hpp index 212ef28e..6bbf8fbc 100644 --- a/saturnringlib/srl_string.hpp +++ b/saturnringlib/srl_string.hpp @@ -218,6 +218,21 @@ namespace SRL } } break; + case 'x' : //hexadecimal + { + char tmp[100] = {0}; + int arg = va_arg(args, int); + snprintf(tmp, 100, "%x", arg); + for(int jdx = 0; tmp[jdx] != 0 ; jdx++ , writtenChars++) + { + if(writtenChars < size) + { + buffer[writtenChars] = tmp[jdx]; + } + + } + } + break; case 'u' : //unsigned int { char tmp[100] = {0}; From 459864b1bbe712ca30ee150e53be1090470de97d Mon Sep 17 00:00:00 2001 From: Jaerder Sousa Date: Thu, 19 Mar 2026 22:03:16 +0000 Subject: [PATCH 2/2] updated documentation --- saturnringlib/srl_string.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/saturnringlib/srl_string.hpp b/saturnringlib/srl_string.hpp index 6bbf8fbc..046874b7 100644 --- a/saturnringlib/srl_string.hpp +++ b/saturnringlib/srl_string.hpp @@ -120,7 +120,7 @@ namespace SRL } /** - * @brief Extension of snprintf with support of SRL::Math::Types::Fxp. Supported format especifiers %c , %s , %u , %d, and %f. %f is used for FXP types. + * @brief Extension of snprintf with support of SRL::Math::Types::Fxp. Supported format specifiers %c , %s , %u , %d, %x and %f. %f is used for FXP types. %0Nd where N is the total lenght of the printed number. If under N , the number will be padded with 0's until the printed string has N characters * @param buffer Buffer where the string will be written to * @param size maximum size of string to be written into buffer * @param format format string