Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:lib\memweight.c Create Date:2022-07-28 06:24:28
Last Modify:2020-03-12 14:18:49 Copyright©Brick
home page Tree
Annotation kernel can get tool activityDownload SCCTChinese

Name:memweight - count the total number of bits set in memory area*@ptr: pointer to the start of the area*@bytes: the size of the area

Proto:size_t memweight(const void *ptr, size_t bytes)

Type:size_t

Parameter:

TypeParameterName
const void *ptr
size_tbytes
13  ret = 0
15  bitmap = ptr
17  When bytes > 0 && bitmap % sizeof(long) cycle ret += returns the hamming weight of a N-bit word( * bitmap)
21  longs = bytes / sizeof(long)
22  If longs Then
23  BUG_ON(longs >= INT_MAX / BITS_PER_LONG)
24  ret += bitmap_weight((unsignedlong * )bitmap, longs * BITS_PER_LONG)
26  bytes -= longs * sizeof(long)
27  bitmap += longs * sizeof(long)
34  When bytes > 0 cycle ret += returns the hamming weight of a N-bit word( * bitmap)
37  Return ret