Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:arch\x86\boot\printf.c Create Date:2022-07-28 07:26:53
Last Modify:2020-03-12 14:18:49 Copyright©Brick
home page Tree
Annotation kernel can get tool activityDownload SCCTChinese

Name:number

Proto:static char *number(char *str, long num, int base, int size, int precision, int type)

Type:char

Parameter:

TypeParameterName
char *str
longnum
intbase
intsize
intprecision
inttype
45  digits[16] = "0123456789ABCDEF"
53  locase = type & Must be 32 == 0x20
54  If type & left justified Then type &= ~pad with zero
56  If base < 2 || base > 16 Then Return NULL
58  c = If type & pad with zero Then '0' Else ' '
59  sign = 0
60  If type & unsigned/signed long Then
61  If num < 0 Then
62  sign = '-'
63  num = -num
64  size--
65  Else if type & show plus Then
66  sign = '+'
67  size--
68  Else if type & space if plus Then
69  sign = ' '
70  size--
73  If type & 0x Then
74  If base == 16 Then size -= 2
76  Else if base == 8 Then size--
79  i = 0
80  If num == 0 Then tmp[i++] = '0'
82  Else When num != 0 cycle
84  tmp[i++] = digits[__do_div(num, base)] | locase
85  If i > precision Then precision = i
87  size -= precision
88  If Not (type & pad with zero + left justified ) Then When size-- > 0 cycle
90  str++ = ' '
91  If sign Then str++ = sign
93  If type & 0x Then
94  If base == 8 Then str++ = '0'
96  Else if base == 16 Then
97  str++ = '0'
98  str++ = 'X' | locase
101  If Not (type & left justified ) Then When size-- > 0 cycle
103  str++ = c
104  When i < precision-- cycle
105  str++ = '0'
106  When i-- > 0 cycle
107  str++ = tmp[i]
108  When size-- > 0 cycle
109  str++ = ' '
110  Return str
Caller
NameDescribe
vsprintf