函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:lib\vsprintf.c Create Date:2022-07-27 07:09:16
Last Modify:2022-05-21 09:47:42 Copyright©Brick
首页 函数Tree
注解内核,赢得工具下载SCCTEnglish

函数名称:number

函数原型:static __attribute__((__noinline__)) char *number(char *buf, char *end, unsigned long long num, struct printf_spec spec)

返回类型:char

参数:

类型参数名称
char *buf
char *end
unsigned long longnum
struct printf_specspec
422  char tmp[3 * num的长度] gcc: 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  如果 flags to number() 按位与left justified flags to number() 与等于pad with zero, must be 16 == '0' - ' ' 的反
436  sign等于0
437  如果 flags to number() 按位与unsigned/signed, must be 1
438  如果num小于0则
439  sign等于'-'
440  num等于负num
441  field_width自减
442  否则如果 flags to number() 按位与show plus
443  sign等于'+'
444  field_width自减
445  否则如果 flags to number() 按位与space if plus
446  sign等于' '
447  field_width自减
450  如果need_pfx
451  如果 number base, 8, 10 or 16 only 恒等于16则field_width减等于2
453  否则如果非is_zerofield_width自减
458  i等于0
459  如果num小于 number base, 8, 10 or 16 only tmp[i++]等于hex_asc_upper[num]按位或locase
461  否则如果 number base, 8, 10 or 16 only 不等于10则
462  mask等于 number base, 8, 10 or 16 only 减1
463  shift等于3
465  如果 number base, 8, 10 or 16 only 恒等于16则shift等于4
467  循环
468  tmp[i++]等于hex_asc_upper[((unsignedchar)num) & mask]按位或locase
469  num右移等于shift
470 num循环
471  否则
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  如果i大于precisionprecision等于i
479  field_width减等于precision
480  如果非 flags to number() 按位与pad with zero, must be 16 == '0' - ' ' 按位或left justified 的值的值则
481 field_width先自减大于等于0循环
482  如果buf小于endbuf等于' '
484  buf先自加
488  如果sign
489  如果buf小于endbuf等于sign
491  buf先自加
494  如果need_pfx
495  如果 number base, 8, 10 or 16 only 恒等于16或非is_zero
496  如果buf小于endbuf等于'0'
498  buf先自加
500  如果 number base, 8, 10 or 16 only 恒等于16则
501  如果buf小于endbuf等于'X'按位或locase
503  buf先自加
507  如果非 flags to number() 按位与left justified 的值则
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 field_width先自减大于等于0循环
511  如果buf小于endbuf等于c
513  buf先自加
517 i小于等于precision先自减循环
518  如果buf小于endbuf等于'0'
520  buf先自加
523 i先自减大于等于0循环
524  如果buf小于endbuf等于tmp[i]
526  buf先自加
529 field_width先自减大于等于0循环
530  如果buf小于endbuf等于' '
532  buf先自加
535  返回:buf
调用者
名称描述
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