Skip to content

Commit

Permalink
clrlwi instruction implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
acabey committed Jan 13, 2020
1 parent f9494c5 commit 3512415
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions lib/bitwise_arithmetic.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,23 @@ def extldi(ry: Union[int, c_uint64], n: int, b: int) -> c_uint64:

return rldicr(ry, b, n - 1)

def clrlwi(ry: Union[int, c_uint64], n: int) -> c_uint64:
"""
Clear the high-order n bits of the low-order 32 bits of register Ry and place the result into register Rx,
clearing the high-order 32 bits of register Rx.
:param ry:
:param n:
:return:
"""
if type(ry) is not c_uint64:
ry = c_uint64(ry)

maskLowerN = mask(64, 32 + n, 63)
rx = c_uint64(ry.value & maskLowerN)

return rx


def subf(ra: c_uint64, rb: c_uint64) -> c_uint64:
if type(ra) is not c_uint64:
Expand Down
Empty file added lib/xecrypt_pss.py
Empty file.

0 comments on commit 3512415

Please sign in to comment.