Skip to content

Commit

Permalink
kernel/hal: hal_i2s doesn't display number when zero==0 and i == 0
Browse files Browse the repository at this point in the history
JIRA: RTOS-843
  • Loading branch information
astalke committed May 29, 2024
1 parent 2b0b1e9 commit 1309f46
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 0 deletions.
4 changes: 4 additions & 0 deletions hal/armv7a/string.c
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,10 @@ unsigned long hal_i2s(const char *prefix, char *s, unsigned long i, unsigned cha
m = hal_strlen(prefix);
hal_memcpy(s, prefix, m);

if ((zero == 0) && (i == 0)) {
s[m++] = '0';
}

for (k = m, l = (unsigned long)-1; l != 0; i /= b, l /= b) {
if ((zero == 0) && (i == 0)) {
break;
Expand Down
4 changes: 4 additions & 0 deletions hal/armv7m/string.c
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,10 @@ unsigned long hal_i2s(const char *prefix, char *s, unsigned long i, unsigned cha
m = hal_strlen(prefix);
hal_memcpy(s, prefix, m);

if ((zero == 0) && (i == 0)) {
s[m++] = '0';
}

for (k = m, l = (unsigned long)-1; l != 0; i /= b, l /= b) {
if ((zero == 0) && (i == 0)) {
break;
Expand Down
4 changes: 4 additions & 0 deletions hal/armv8m/string.c
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,10 @@ unsigned long hal_i2s(const char *prefix, char *s, unsigned long i, unsigned cha
m = hal_strlen(prefix);
hal_memcpy(s, prefix, m);

if ((zero == 0) && (i == 0)) {
s[m++] = '0';
}

for (k = m, l = (unsigned long)-1; l != 0; i /= b, l /= b) {
if ((zero == 0) && (i == 0)) {
break;
Expand Down
4 changes: 4 additions & 0 deletions hal/ia32/string.c
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,10 @@ unsigned long hal_i2s(const char *prefix, char *s, unsigned long i, unsigned cha
m = hal_strlen(prefix);
hal_memcpy(s, prefix, m);

if ((zero == 0) && (i == 0)) {
s[m++] = '0';
}

for (k = m, l = (unsigned long)-1; l != 0; i /= b, l /= b) {
if ((zero == 0) && (i == 0)) {
break;
Expand Down
4 changes: 4 additions & 0 deletions hal/riscv64/string.c
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,10 @@ unsigned long hal_i2s(const char *prefix, char *s, unsigned long i, unsigned cha
m = hal_strlen(prefix);
hal_memcpy(s, prefix, m);

if ((zero == 0) && (i == 0)) {
s[m++] = '0';
}

for (k = m, l = (unsigned long)-1; l != 0; i /= b, l /= b) {
if ((zero == 0) && (i == 0)) {
break;
Expand Down
4 changes: 4 additions & 0 deletions hal/sparcv8leon3/string.c
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,10 @@ unsigned long hal_i2s(const char *prefix, char *s, unsigned long i, unsigned cha
m = hal_strlen(prefix);
hal_memcpy(s, prefix, m);

if ((zero == 0) && (i == 0)) {
s[m++] = '0';
}

for (k = m, l = (unsigned long)-1; l != 0; i /= b, l /= b) {
if ((zero == 0) && (i == 0)) {
break;
Expand Down

0 comments on commit 1309f46

Please sign in to comment.