mirror of
https://github.com/DragonOS-Community/DragonOS.git
synced 2025-06-25 05:53:22 +00:00
Patch add idr (#56)
* 增加了idr模块 * 增加了IDR模块,并尝试覆盖上一个错误版本. * 增加了IDR模块 * 修改了test-idr.c文件 * 进一步完善函数注释 * 更新idr文档同时修改了test-idr的错误 * 将lz4库改为使用系统的clz函数 * idr和test-idr O1 * bugfix: 修复测试用例中的移位问题 * 修正问题 Signed-off-by: guanjinquan <1666320330@qq.com> Co-authored-by: fslongjin <longjin@RinGoTek.cn>
This commit is contained in:
@ -52,4 +52,18 @@ static __always_inline int __clzll(unsigned long long x)
|
||||
: "a"(x)
|
||||
: "memory");
|
||||
return res;
|
||||
}
|
||||
}
|
||||
|
||||
static __always_inline int __ctz(uint32_t x)
|
||||
{
|
||||
asm volatile("tzcnt %%eax, %%eax":"=a"(x):"a"(x):"memory");
|
||||
return x;
|
||||
}
|
||||
|
||||
static __always_inline int __ctzl(unsigned long x)
|
||||
{
|
||||
asm volatile("tzcnt %%rax, %%rax":"=a"(x):"a"(x):"memory");
|
||||
return x;
|
||||
}
|
||||
|
||||
#define __ctzll __ctzl
|
Reference in New Issue
Block a user