函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

函数名称:Based on code by Douglas W. Jones found at* <http://www.cs.uiowa.edu/~jones/bcd/decimal.html#sixtyfour>* (with permission from the author).* Performs no 64-bit division and hence should be fast on 32-bit machines.

函数原型:static char *put_dec(char *buf, unsigned long long n)

返回类型:char

参数:

类型参数名称
char *buf
unsigned long longn
307  如果n小于100乘1000乘1000则返回:This will print a single '0' even if r == 0, since we would* immediately jump to out_r where two 0s would be written but only* one of them accounted for in buf. This is needed by ip4_string* below. All other callers pass a non-zero value of r.
310  d1等于n右移16位
311  h等于n右移32位
312  d2等于h按位与0xffff
313  d3等于h右移16位
317  q等于656乘d3加7296乘d2加5536乘d1n按位与0xffff的值
318  q等于Call put_dec_full4 on x % 10000, return x / 10000.* The approximation x/10000 == (x * 0x346DC5D7) >> 43* holds for all x < 1,128,869,999. The largest value this* helper will ever be asked to convert is 1,125,520,955.
320  q加等于7671乘d3加9496乘d2加6乘d1
321  q等于Call put_dec_full4 on x % 10000, return x / 10000.* The approximation x/10000 == (x * 0x346DC5D7) >> 43* holds for all x < 1,128,869,999. The largest value this* helper will ever be asked to convert is 1,125,520,955.
323  q加等于4749乘d3加42乘d2
324  q等于Call put_dec_full4 on x % 10000, return x / 10000.* The approximation x/10000 == (x * 0x346DC5D7) >> 43* holds for all x < 1,128,869,999. The largest value this* helper will ever be asked to convert is 1,125,520,955.
326  q加等于281乘d3
327  buf加等于12
328  如果qbuf等于This will print a single '0' even if r == 0, since we would* immediately jump to out_r where two 0s would be written but only* one of them accounted for in buf. This is needed by ip4_string* below. All other callers pass a non-zero value of r.
330  否则当buf[ - 1]恒等于'0'循环
331  buf先自减
333  返回:buf
调用者
名称描述
num_to_strConvert passed number to decimal string.* Returns the length of string. On buffer overflow, returns 0.* If speed is not important, use snprintf(). It's easy to read the code.
number