Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:lib\vsprintf.c Create Date:2022-07-28 06:12:00
Last Modify:2022-05-21 09:47:42 Copyright©Brick
home page Tree
Annotation kernel can get tool activityDownload SCCTChinese

Name:number

Proto:static __attribute__((__noinline__)) char *number(char *buf, char *end, unsigned long long num, struct printf_spec spec)

Type:char

Parameter:

TypeParameterName
char *buf
char *end
unsigned long longnum
struct printf_specspec
422  char tmp[3 * size of numgcc: https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html#index-aligned-function-attribute* gcc: https://gcc.gnu.org/onlinedocs/gcc/Common-Type-Attributes.html#index-aligned-type-attribute* gcc: https://gcc(2)
425  need_pfx = flags to number() & prefix hex with "0x", octal with "0" && number base, 8, 10 or 16 only != 10
427  is_zero = num == 0LL
428  field_width = width of output field
429  precision = # of digits/chars
433  locase = flags to number() & use lowercase in hex (must be 32 == 0x20)
434  If flags to number() & left justified Then flags to number() &= ~pad with zero, must be 16 == '0' - ' '
436  sign = 0
437  If flags to number() & unsigned/signed, must be 1 Then
438  If num < 0 Then
439  sign = '-'
440  num = -num
441  field_width--
442  Else if flags to number() & show plus Then
443  sign = '+'
444  field_width--
446  sign = ' '
447  field_width--
450  If need_pfx Then
451  If number base, 8, 10 or 16 only == 16 Then field_width -= 2
453  Else if Not is_zero Then field_width--
458  i = 0
459  If num < number base, 8, 10 or 16 only Then tmp[i++] = hex_asc_upper[num] | locase
461  Else if number base, 8, 10 or 16 only != 10 Then
462  mask = number base, 8, 10 or 16 only - 1
463  shift = 3
465  If number base, 8, 10 or 16 only == 16 Then shift = 4
467  Do
468  tmp[i++] = hex_asc_upper[((unsignedchar)num) & mask] | locase
469  num >>= shift
470  When num cycle
471  Else
472  i = Based on code by Douglas W. Jones found at* * (with permission from the author).* Performs no 64-bit division and hence should be fast on 32-bit machines. - tmp
476  If i > precision Then precision = i
479  field_width -= precision
480  If Not ( flags to number() & (pad with zero, must be 16 == '0' - ' ' | left justified )) Then
481  When --field_width >= 0 cycle
482  If buf < end Then buf = ' '
484  ++buf
488  If sign Then
489  If buf < end Then buf = sign
491  ++buf
494  If need_pfx Then
495  If number base, 8, 10 or 16 only == 16 || Not is_zero Then
496  If buf < end Then buf = '0'
498  ++buf
501  If buf < end Then buf = 'X' | locase
503  ++buf
507  If Not ( flags to number() & left justified ) Then
508  c = ' ' + ( flags to number() & pad with zero, must be 16 == '0' - ' ' )
509  BUILD_BUG_ON - break compile if a condition is true(' ' + pad with zero, must be 16 == '0' - ' ' != '0')
510  When --field_width >= 0 cycle
511  If buf < end Then buf = c
513  ++buf
517  When i <= --precision cycle
518  If buf < end Then buf = '0'
520  ++buf
523  When --i >= 0 cycle
524  If buf < end Then buf = tmp[i]
526  ++buf
529  When --field_width >= 0 cycle
530  If buf < end Then buf = ' '
532  ++buf
535  Return buf
Caller
NameDescribe
special_hex_number
err_ptr
pointer_string
bdev_name
resource_string
bitmap_string
bitmap_list_string
ip6_addr_string_sa
ip4_addr_string_sa
date_str
time_str
format_flags
device_node_string
vsnprintfvsnprintf - Format a string and place it in a buffer*@buf: The buffer to place the result into*@size: The size of the buffer, including the trailing null space*@fmt: The format string to use*@args: Arguments for the format string* This function generally