16#if (!defined(ARCHCFG_LIB_XWBOP_RBIT8)) || (1 != ARCHCFG_LIB_XWBOP_RBIT8)
17# define XWBOP_RBIT8_R2(n) (n), ((n) + 2U * 64U), ((n) + 1U * 64U), ((n) + 3U * 64U)
18# define XWBOP_RBIT8_R4(n) XWBOP_RBIT8_R2(n), \
19 XWBOP_RBIT8_R2((n) + 2U * 16U), \
20 XWBOP_RBIT8_R2((n) + 1U * 16U), \
21 XWBOP_RBIT8_R2((n) + 3U * 16U)
22# define XWBOP_RBIT8_R6(n) XWBOP_RBIT8_R4(n), \
23 XWBOP_RBIT8_R4((n) + 2U * 4U), \
24 XWBOP_RBIT8_R4((n) + 1U * 4U), \
25 XWBOP_RBIT8_R4((n) + 3U * 4U)
28#if (!defined(ARCHCFG_LIB_XWBOP_RBIT8)) || (1 != ARCHCFG_LIB_XWBOP_RBIT8)
34 XWBOP_RBIT8_R6(0U), XWBOP_RBIT8_R6(2U), XWBOP_RBIT8_R6(1U), XWBOP_RBIT8_R6(3U),
38#if (!defined(ARCHCFG_LIB_XWBOP_FFS8)) || (1 != ARCHCFG_LIB_XWBOP_FFS8)
54 if (0 == (x & (
xwu8_t)0x0F)) {
58 if (0 == (x & (
xwu8_t)0x03)) {
62 if (0 == (x & (
xwu8_t)0x01)) {
71#if ((!defined(ARCHCFG_LIB_XWBOP_FLS8)) || (1 != ARCHCFG_LIB_XWBOP_FLS8))
87 if (0 == (x & (
xwu8_t)0xF0)) {
91 if (0 == (x & (
xwu8_t)0xC0)) {
95 if (0 == (x & (
xwu8_t)0x80)) {
104#if ((!defined(ARCHCFG_LIB_XWBOP_FFZ8)) || (1 != ARCHCFG_LIB_XWBOP_FFZ8))
112#if (!defined(ARCHCFG_LIB_XWBOP_FLZ8)) || (1 != ARCHCFG_LIB_XWBOP_FLZ8)
120#if (!defined(ARCHCFG_LIB_XWBOP_RBIT8)) || (1 != ARCHCFG_LIB_XWBOP_RBIT8)
124 return xwbop_rbit8_table[x];
128#if (!defined(ARCHCFG_LIB_XWBOP_WEIGHT8)) || (1 != ARCHCFG_LIB_XWBOP_WEIGHT8)
138#if (!defined(ARCHCFG_LIB_XWBOP_FFS16)) || (1 != ARCHCFG_LIB_XWBOP_FFS16)
143# if defined(__GNUC__)
154 if (0 == (x & (
xwu16_t)0x00FF)) {
158 if (0 == (x & (
xwu16_t)0x000F)) {
162 if (0 == (x & (
xwu16_t)0x0003)) {
166 if (0 == (x & (
xwu16_t)0x0001)) {
175#if ((!defined(ARCHCFG_LIB_XWBOP_FLS16)) || (1 != ARCHCFG_LIB_XWBOP_FLS16))
180# if defined(__GNUC__)
191 if (0 == (x & (
xwu16_t)0xFF00)) {
195 if (0 == (x & (
xwu16_t)0xF000)) {
199 if (0 == (x & (
xwu16_t)0xC000)) {
203 if (0 == (x & (
xwu16_t)0x8000)) {
212#if ((!defined(ARCHCFG_LIB_XWBOP_FFZ16)) || (1 != ARCHCFG_LIB_XWBOP_FFZ16))
220#if ((!defined(ARCHCFG_LIB_XWBOP_FLZ16)) || (1 != ARCHCFG_LIB_XWBOP_FLZ16))
228#if (!defined(ARCHCFG_LIB_XWBOP_RBIT16)) || (1 != ARCHCFG_LIB_XWBOP_RBIT16)
247#if (!defined(ARCHCFG_LIB_XWBOP_RE16)) || (1 != ARCHCFG_LIB_XWBOP_RE16)
265#if (!defined(ARCHCFG_LIB_XWBOP_WEIGHT16)) || (1 != ARCHCFG_LIB_XWBOP_WEIGHT16)
276#if (!defined(ARCHCFG_LIB_XWBOP_FFS32)) || (1 != ARCHCFG_LIB_XWBOP_FFS32)
281# if defined(__GNUC__)
292 if (0 == (x & (
xwu32_t)0x0000FFFF)) {
296 if (0 == (x & (
xwu32_t)0x000000FF)) {
300 if (0 == (x & (
xwu32_t)0x0000000F)) {
304 if (0 == (x & (
xwu32_t)0x00000003)) {
308 if (0 == (x & (
xwu32_t)0x00000001)) {
317#if ((!defined(ARCHCFG_LIB_XWBOP_FLS32)) || (1 != ARCHCFG_LIB_XWBOP_FLS32))
322# if defined(__GNUC__)
333 if (0 == (x & (
xwu32_t)0xFFFF0000)) {
337 if (0 == (x & (
xwu32_t)0xFF000000)) {
341 if (0 == (x & (
xwu32_t)0xF0000000)) {
345 if (0 == (x & (
xwu32_t)0xC0000000)) {
349 if (0 == (x & (
xwu32_t)0x80000000)) {
358#if ((!defined(ARCHCFG_LIB_XWBOP_FFZ32)) || (1 != ARCHCFG_LIB_XWBOP_FFZ32))
366#if ((!defined(ARCHCFG_LIB_XWBOP_FLZ32)) || (1 != ARCHCFG_LIB_XWBOP_FLZ32))
374#if (!defined(ARCHCFG_LIB_XWBOP_RBIT32)) || (1 != ARCHCFG_LIB_XWBOP_RBIT32)
397#if (!defined(ARCHCFG_LIB_XWBOP_RE32)) || (1 != ARCHCFG_LIB_XWBOP_RE32)
419#if (!defined(ARCHCFG_LIB_XWBOP_WEIGHT32)) || (1 != ARCHCFG_LIB_XWBOP_WEIGHT32)
426 res = res + (res >> (
xwu32_t)8);
431#if ((!defined(ARCHCFG_LIB_XWBOP_FFS64)) || (1 != ARCHCFG_LIB_XWBOP_FFS64))
436# if defined(__GNUC__)
447 if (0 == (x & (
xwu64_t)0xFFFFFFFF)) {
451 if (0 == (x & (
xwu64_t)0xFFFF)) {
455 if (0 == (x & (
xwu64_t)0xFF)) {
476#if (!defined(ARCHCFG_LIB_XWBOP_FLS64)) || (1 != ARCHCFG_LIB_XWBOP_FLS64)
481# if defined(__GNUC__)
485 r = (
xwssq_t)63 - (
xwssq_t)__builtin_clzll((
unsigned long long)x);
492 if (0 == (x & (
xwu64_t)0xFFFFFFFF00000000)) {
497 if (0 == (x & (
xwu64_t)0xFFFF0000)) {
501 if (0 == (x & (
xwu64_t)0xFF000000)) {
505 if (0 == (x & (
xwu64_t)0xF0000000)) {
509 if (0 == (x & (
xwu64_t)0xC0000000)) {
513 if (0 == (x & (
xwu64_t)0x80000000)) {
522#if ((!defined(ARCHCFG_LIB_XWBOP_FFZ64)) || (1 != ARCHCFG_LIB_XWBOP_FFZ64))
530#if ((!defined(ARCHCFG_LIB_XWBOP_FLZ64)) || (1 != ARCHCFG_LIB_XWBOP_FLZ64))
538#if (!defined(ARCHCFG_LIB_XWBOP_RBIT64)) || (1 != ARCHCFG_LIB_XWBOP_RBIT64)
569#if (!defined(ARCHCFG_LIB_XWBOP_RE64)) || (1 != ARCHCFG_LIB_XWBOP_RE64)
599#if (!defined(ARCHCFG_LIB_XWBOP_WEIGHT64)) || (1 != ARCHCFG_LIB_XWBOP_WEIGHT64)
604 res = (res & (
xwu64_t)0x3333333333333333) +
607 res = res + (res >> (
xwu64_t)8);
608 res = res + (res >> (
xwu64_t)16);
609 return (res + (res >> (
xwu64_t)32)) & (
xwu64_t)0x00000000000000FF;
619 for (i = 0; i < n; i++) {
633 for (j = n; j > (
xwsz_t)0; j--) {
635 if (bmp[i] < opd[i]) {
638 }
else if (bmp[i] > opd[i]) {
652 for (i = 0; i < n; i++) {
663 for (i = 0; i < n; i++) {
668#if (!defined(ARCHCFG_LIB_XWBMPOP_S1I)) || (1 != ARCHCFG_LIB_XWBMPOP_S1I)
684 for (i = 0; i < size; i++) {
689#if (!defined(ARCHCFG_LIB_XWBMPOP_C0I)) || (1 != ARCHCFG_LIB_XWBMPOP_C0I)
705 for (i = 0; i < size; i++) {
710#if (!defined(ARCHCFG_LIB_XWBMPOP_X1I)) || (1 != ARCHCFG_LIB_XWBMPOP_X1I)
726 for (i = 0; i < size; i++) {
731#if (!defined(ARCHCFG_LIB_XWBMPOP_T1I)) || (1 != ARCHCFG_LIB_XWBMPOP_T1I)
749 for (i = 0; i < size; i++) {
750 ret = !!((bmp[i] & msk[i]) == msk[i]);
767 for (i = 0; i < size; i++) {
768 ret = !!((bmp[i] & msk[i]) == msk[i]);
774 for (i = 0; i < size; i++) {
790 for (i = 0; i < size; i++) {
791 ret = !!(bmp[i] & msk[i]);
808 for (i = 0; i < size; i++) {
809 ret = !!(bmp[i] & msk[i]);
815 for (i = 0; i < size; i++) {
831 for (i = 0; i < size; i++) {
832 ret = !(bmp[i] & msk[i]);
849 for (i = 0; i < size; i++) {
850 ret = !(bmp[i] & msk[i]);
856 for (i = 0; i < size; i++) {
872 for (i = 0; i < size; i++) {
873 ret = !!((bmp[i] & msk[i]) != msk[i]);
890 for (i = 0; i < size; i++) {
891 ret = !!((bmp[i] & msk[i]) != msk[i]);
897 for (i = 0; i < size; i++) {
911 for (i = 0; i < size; i++) {
923 for (i = 0; i < size; i++) {
935 for (i = 0; i < size; i++) {
947 for (i = 0; i < size; i++) {
952#if (!defined(ARCHCFG_LIB_XWBMPOP_FFS)) || (1 != ARCHCFG_LIB_XWBMPOP_FFS)
961 for (i = 0; i < m; i++) {
982#if (!defined(ARCHCFG_LIB_XWBMPOP_FFZ)) || (1 != ARCHCFG_LIB_XWBMPOP_FFZ)
991 for (i = 0; i < m; i++) {
1012#if (!defined(ARCHCFG_LIB_XWBMPOP_FLS)) || (1 != ARCHCFG_LIB_XWBMPOP_FLS)
1037#if (!defined(ARCHCFG_LIB_XWBMPOP_FLZ)) || (1 != ARCHCFG_LIB_XWBMPOP_FLZ)
1071 for (i = 0; i < n; i++) {
xwssq_t xwbmpop_ffs(xwbmp_t *bmp, xwsz_t num)
XWOS BOPLIB:在位图中从最低位起查找第一个被置1的位
xwssq_t xwbmpop_fls(xwbmp_t *bmp, xwsz_t num)
XWOS BOPLIB:在位图中从最高位起查找第一个被置1的位
xwssq_t xwbop_fls32(xwu32_t x)
void xwbmpop_x1m(xwbmp_t *bmp, xwbmp_t msk[], xwsz_t num)
XWOS BOPLIB:将位图中掩码部分翻转
#define xwbop_x1m(type, addr, mask)
XWOS BOPLIB:将数据掩码部分的位全部翻转
xwu32_t xwbop_re32(xwu32_t x)
void xwbmpop_assign(xwbmp_t *bmp, xwbmp_t opd[], xwsz_t num)
XWOS BOPLIB:赋值操作数到位图
xwssq_t xwbop_flz8(xwu8_t x)
xwssq_t xwbop_ffz8(xwu8_t x)
#define xwbop_fls(type, data)
XWOS BOPLIB:在数据中从最高位起查找第一个被置1的位
bool xwbmpop_t0ma_then_s1m(xwbmp_t *bmp, xwbmp_t msk[], xwsz_t num)
XWOS BOPLIB:测试位图中掩码部分是否全部为0,如果是,就将掩码部分全部置1
bool xwbmpop_t1i(xwbmp_t *bmp, xwsq_t n)
XWOS BOPLIB:测试位图中的单个位是否为1
xwsz_t xwbop_weight32(xwu32_t x)
xwu64_t xwbop_re64(xwu64_t x)
#define xwbop_weight(type, data)
XWOS BOPLIB:统计数据中1的个数
bool xwbmpop_t1mo(xwbmp_t *bmp, xwbmp_t msk[], xwsz_t num)
XWOS BOPLIB:测试位图中掩码部分是否至少有一位为1
xwsz_t xwbop_weight64(xwu64_t x)
xwu8_t xwbop_rbit8(xwu8_t x)
bool xwbmpop_t1mo_then_c0m(xwbmp_t *bmp, xwbmp_t msk[], xwsz_t num)
XWOS BOPLIB:测试位图中掩码部分是否至少有一位为1,如果是,就将掩码部分全部清0
void xwbmpop_and(xwbmp_t *bmp, xwbmp_t opd[], xwsz_t num)
XWOS BOPLIB:将位图与操作数进行逐位“与”运算
xwssq_t xwbop_ffz64(xwu64_t x)
#define BITS_TO_XWBMP_T(n)
xwssq_t xwbop_fls64(xwu64_t x)
xwssq_t xwbop_ffs8(xwu8_t x)
xwu16_t xwbop_rbit16(xwu16_t x)
xwssq_t xwbop_ffs32(xwu32_t x)
xwu32_t xwbop_rbit32(xwu32_t x)
xwssq_t xwbmpop_flz(xwbmp_t *bmp, xwsz_t num)
XWOS BOPLIB:在位图中从最高位起查找第一个被清0的位
xwssq_t xwbop_flz32(xwu32_t x)
#define xwbop_flz(type, data)
XWOS BOPLIB:在数据中从最高位起查找第一个被清0的位
xwu16_t xwbop_re16(xwu16_t a)
void xwbmpop_c0all(xwbmp_t *bmp, xwsq_t num)
XWOS BOPLIB:将位图中所有位清0
void xwbmpop_s1m(xwbmp_t *bmp, xwbmp_t msk[], xwsz_t num)
XWOS BOPLIB:将位图中掩码部分置1
bool xwbmpop_t0ma(xwbmp_t *bmp, xwbmp_t msk[], xwsz_t num)
XWOS BOPLIB:测试位图中掩码部分是否全部为0
xwsz_t xwbop_weight16(xwu16_t x)
xwssq_t xwbop_ffz16(xwu16_t x)
xwu64_t xwbop_rbit64(xwu64_t x)
void xwbmpop_s1i(xwbmp_t *bmp, xwsq_t n)
XWOS BOPLIB:将位图中单个位置1
#define xwbop_c0m(type, addr, mask)
XWOS BOPLIB:将数据掩码部分的位全部清0
void xwbmpop_s1all(xwbmp_t *bmp, xwsq_t num)
XWOS BOPLIB:将位图中所有位置1
#define xwbop_s1m(type, addr, mask)
XWOS BOPLIB:将数据掩码部分的位全部置1
#define xwbop_ffz(type, data)
XWOS BOPLIB:在数据中从最低位起查找第一个被清0的位
xwssq_t xwbop_flz16(xwu16_t x)
xwssq_t xwbop_ffs16(xwu16_t x)
xwssq_t xwbop_ffz32(xwu32_t x)
xwssq_t xwbop_fls16(xwu16_t x)
void xwbmpop_x1i(xwbmp_t *bmp, xwsq_t n)
XWOS BOPLIB:将位图中单个位翻转
void xwbmpop_not(xwbmp_t *bmp, xwsz_t num)
XWOS BOPLIB:将位图按位取反
#define XWBOP_BMP_MASK(n)
void xwbmpop_c0i(xwbmp_t *bmp, xwsq_t n)
XWOS BOPLIB:将位图中单个位清0
xwssq_t xwbmpop_cmp(xwbmp_t *bmp, xwbmp_t opd[], xwsz_t num)
XWOS BOPLIB:从数组最高元素开始比较两个位图的数值大小
bool xwbmpop_t1ma(xwbmp_t *bmp, xwbmp_t msk[], xwsz_t num)
XWOS BOPLIB:测试位图中掩码部分是否全部为1
void xwbmpop_or(xwbmp_t *bmp, xwbmp_t opd[], xwsz_t num)
XWOS BOPLIB:将位图与操作数进行逐位“或”运算
bool xwbmpop_t0mo_then_s1m(xwbmp_t *bmp, xwbmp_t msk[], xwsz_t num)
XWOS BOPLIB:测试位图中掩码部分是否至少有一位为0,如果是,就将掩码部分全部置1
void xwbmpop_xor(xwbmp_t *bmp, xwbmp_t opd[], xwsz_t num)
XWOS BOPLIB:将位图与操作数进行逐位“异或”运算
xwssq_t xwbmpop_ffz(xwbmp_t *bmp, xwsz_t num)
XWOS BOPLIB:在位图中从最低位起查找第一个被清0的位
#define xwbop_ffs(type, data)
XWOS BOPLIB:在数据中从最低位起查找第一个被置1的位
bool xwbmpop_t1ma_then_c0m(xwbmp_t *bmp, xwbmp_t msk[], xwsz_t num)
XWOS BOPLIB:测试位图中掩码部分是否全部为1,如果是,就将掩码部分全部清0
xwssq_t xwbop_flz64(xwu64_t x)
xwssq_t xwbop_ffs64(xwu64_t x)
xwsz_t xwbop_weight8(xwu8_t x)
xwsz_t xwbmpop_weight(xwbmp_t *bmp, xwsz_t num)
XWOS BOPLIB:在位图中统计被置1的位的个数
xwssq_t xwbop_fls8(xwu8_t x)
bool xwbmpop_t0mo(xwbmp_t *bmp, xwbmp_t msk[], xwsz_t num)
XWOS BOPLIB:测试位图中掩码部分是否至少有一位为0
void xwbmpop_c0m(xwbmp_t *bmp, xwbmp_t msk[], xwsz_t num)
XWOS BOPLIB:将位图中掩码部分清0