Changeset cdafab1 in mainline
- Timestamp:
- 2006-04-23T15:04:08Z (19 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- d3b8c1f
- Parents:
- 34c4d69
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
libc/generic/io/print.c
r34c4d69 rcdafab1 166 166 char d[PRINT_NUMBER_BUFFER_SIZE]; /* this is good enough even for base == 2, prefix and sign */ 167 167 char *ptr = &d[PRINT_NUMBER_BUFFER_SIZE - 1]; 168 int size = 0; 168 int size = 0; /* size of number with all prefixes and signs */ 169 int number_size; /* size of plain number */ 169 170 int written = 0; 170 171 char sgn; … … 184 185 } while (num /= base); 185 186 } 186 187 188 number_size = size; 189 187 190 /* Collect sum of all prefixes/signs/... to calculate padding and leading zeroes */ 188 191 if (flags & __PRINTF_FLAG_PREFIX) { … … 221 224 if (flags & __PRINTF_FLAG_ZEROPADDED) { 222 225 if ((precision == 0) && (width > size)) { 223 precision = width - size ;226 precision = width - size + number_size; 224 227 } 225 228 } 226 229 227 230 /* print leading spaces */ 228 if ( size > precision) /* We must print whole number not only a part */229 precision = size;230 231 width -= precision ;231 if (number_size > precision) /* We must print whole number not only a part */ 232 precision = number_size; 233 234 width -= precision + size - number_size; 232 235 233 236 if (!(flags & __PRINTF_FLAG_LEFTALIGNED)) { … … 274 277 275 278 /* print leading zeroes */ 276 precision -= size;279 precision -= number_size; 277 280 while (precision-- > 0) { 278 281 putchar('0');
Note:
See TracChangeset
for help on using the changeset viewer.