Skip to content

Commit 4733f58

Browse files
committed
添加与删除 opsbits
1 parent 533373f commit 4733f58

File tree

2 files changed

+29
-13
lines changed

2 files changed

+29
-13
lines changed

components/drivers/virtio/virtio_input.h

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -86,19 +86,6 @@ struct virtio_input_event
8686
rt_uint32_t value;
8787
};
8888

89-
#ifdef ARCH_CPU_64BIT
90-
#define BITS_PER_LONG 64
91-
#else
92-
#define BITS_PER_LONG 32
93-
#endif
94-
#define BIT_MASK(nr) (1UL << ((nr) % BITS_PER_LONG))
95-
#define BIT_WORD(nr) ((nr) / BITS_PER_LONG)
96-
#define DIV_ROUND_UP(n, d) (((n) + (d) - 1) / (d))
97-
98-
#define BITS_PER_BYTE 8
99-
#define BITS_PER_TYPE(type) (sizeof(type) * BITS_PER_BYTE)
100-
#define BITS_TO_BYTES(nr) DIV_ROUND_UP(nr, BITS_PER_TYPE(char))
101-
#define BITS_TO_LONGS(nr) DIV_ROUND_UP(nr, BITS_PER_TYPE(long))
10289

10390
struct virtio_input_device
10491
{

include/rtdef.h

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1450,6 +1450,35 @@ typedef struct rt_channel *rt_channel_t;
14501450
/**@}*/
14511451
#endif /* RT_USING_DEVICE */
14521452

1453+
/* BITOPS */
1454+
1455+
#if defined (ARCH_CPU_64BIT)
1456+
#define BITS_PER_LONG 64
1457+
#else
1458+
#define BITS_PER_LONG 32
1459+
#endif
1460+
#define BITS_PER_LONG_LONG 64
1461+
1462+
#define DIV_ROUND_UP(n,d) (((n) + (d) - 1) / (d))
1463+
1464+
#define BIT(nr) (1UL << (nr))
1465+
#define BIT_ULL(nr) (1ULL << (nr))
1466+
#define BIT_MASK(nr) (1UL << ((nr) % BITS_PER_LONG))
1467+
#define BIT_WORD(nr) ((nr) / BITS_PER_LONG)
1468+
#define BIT_ULL_MASK(nr) (1ULL << ((nr) % BITS_PER_LONG_LONG))
1469+
#define BIT_ULL_WORD(nr) ((nr) / BITS_PER_LONG_LONG)
1470+
#define BITS_PER_BYTE 8
1471+
#define BITS_PER_TYPE(type) (sizeof(type) * BITS_PER_BYTE)
1472+
#define BITS_TO_BYTES(nr) DIV_ROUND_UP(nr, BITS_PER_TYPE(char))
1473+
#define BITS_TO_LONGS(nr) DIV_ROUND_UP(nr, BITS_PER_TYPE(long))
1474+
1475+
#define GENMASK(h, l) \
1476+
(((~0UL) << (l)) & (~0UL >> (BITS_PER_LONG - 1 - (h))))
1477+
1478+
#define GENMASK_ULL(h, l) \
1479+
(((~0ULL) << (l)) & (~0ULL >> (BITS_PER_LONG_LONG - 1 - (h))))
1480+
1481+
14531482
#ifdef __cplusplus
14541483
}
14551484
#endif

0 commit comments

Comments
 (0)