2022-12-05 00:45:21 +00:00
|
|
|
# Copyright (C) 2022 Exaloop Inc. <https://exaloop.io>
|
2021-09-27 18:02:44 +00:00
|
|
|
|
2022-01-24 07:06:28 +00:00
|
|
|
def __ac_isempty(flag: Ptr[u32], i: int) -> int:
|
|
|
|
return int(flag[i >> 4] >> u32((i & 0xF) << 1)) & 2
|
2021-09-27 18:02:44 +00:00
|
|
|
|
2022-01-24 07:06:28 +00:00
|
|
|
def __ac_isdel(flag: Ptr[u32], i: int) -> int:
|
|
|
|
return int(flag[i >> 4] >> u32((i & 0xF) << 1)) & 1
|
2021-09-27 18:02:44 +00:00
|
|
|
|
2022-01-24 07:06:28 +00:00
|
|
|
def __ac_iseither(flag: Ptr[u32], i: int) -> int:
|
|
|
|
return int(flag[i >> 4] >> u32((i & 0xF) << 1)) & 3
|
2021-09-27 18:02:44 +00:00
|
|
|
|
2022-02-16 15:51:16 +00:00
|
|
|
def __ac_set_isdel_false(flag: Ptr[u32], i: int):
|
2022-01-24 07:06:28 +00:00
|
|
|
flag[i >> 4] &= u32(~(1 << ((i & 0xF) << 1)))
|
|
|
|
|
2022-02-16 15:51:16 +00:00
|
|
|
def __ac_set_isempty_false(flag: Ptr[u32], i: int):
|
2022-01-24 07:06:28 +00:00
|
|
|
flag[i >> 4] &= u32(~(2 << ((i & 0xF) << 1)))
|
|
|
|
|
2022-02-16 15:51:16 +00:00
|
|
|
def __ac_set_isboth_false(flag: Ptr[u32], i: int):
|
2022-01-24 07:06:28 +00:00
|
|
|
flag[i >> 4] &= u32(~(3 << ((i & 0xF) << 1)))
|
|
|
|
|
2022-02-16 15:51:16 +00:00
|
|
|
def __ac_set_isdel_true(flag: Ptr[u32], i: int):
|
2022-01-24 07:06:28 +00:00
|
|
|
flag[i >> 4] |= u32(1 << ((i & 0xF) << 1))
|
|
|
|
|
|
|
|
def __ac_fsize(m) -> int:
|
2021-09-27 18:02:44 +00:00
|
|
|
return 1 if m < 16 else m >> 4
|