print: minor, add spaces around operators
This commit is contained in:
parent
60a1859008
commit
3b7179d49a
|
@ -2,7 +2,7 @@
|
|||
* @file
|
||||
* @author King Kévin <kingkevin@cuvoodoo.info>
|
||||
* @copyright SPDX-License-Identifier: GPL-3.0-or-later
|
||||
* @date 2017-2019
|
||||
* @date 2017-2020
|
||||
*/
|
||||
/* standard libraries */
|
||||
#include <stdint.h> // standard integer types
|
||||
|
@ -94,7 +94,7 @@ static size_t print_unsigned(char** str, size_t* size, uint64_t u, uint32_t padd
|
|||
uint8_t digits = 0; // to count the number of digits
|
||||
size_t length = 0; // number of characters printed
|
||||
do {
|
||||
number[digits++] = '0'+(u % 10); // store digit
|
||||
number[digits++] = '0' + (u % 10); // store digit
|
||||
u /= 10; // go to next digit
|
||||
} while (u > 0);
|
||||
if (sign) { // print sign
|
||||
|
@ -119,9 +119,9 @@ static size_t print_unsigned(char** str, size_t* size, uint64_t u, uint32_t padd
|
|||
**/
|
||||
static size_t print_signed(char** str, size_t* size, int64_t d, uint32_t padding, bool sign) {
|
||||
size_t length = 0; // number of characters printed
|
||||
if (d<0) {
|
||||
if (d < 0) {
|
||||
print_printed(&length, print_char(str, size, '-')); // print sign
|
||||
print_printed(&length, print_unsigned(str, size, (uint64_t)-d, padding, false)); // print number (casting because there is one more negative value then positive value)
|
||||
print_printed(&length, print_unsigned(str, size, (uint64_t) - d, padding, false)); // print number (casting because there is one more negative value then positive value)
|
||||
} else {
|
||||
print_printed(&length, print_unsigned(str, size, d, padding, sign)); // print number
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue