comparison python/ppci/bitfun.py @ 346:3bb7dcfe5529

expanded arm target
author Windel Bouwman
date Fri, 07 Mar 2014 17:05:32 +0100
parents
children 98ff43cfdd36
comparison
equal deleted inserted replaced
345:b4882ff0ed06 346:3bb7dcfe5529
1
2
3 def rotate_right(v, n):
4 """ bit-wise Rotate right n times """
5 mask = (2**n) - 1
6 mask_bits = v & mask
7 return (v >> n) | (mask_bits << (32 - n))
8
9 def rotate_left(v, n):
10 assert n >= 0
11 assert n < 32
12 return rotate_right(v, 32 - n)
13
14