Bitwise operations: Difference between revisions

m
 
(One intermediate revision by the same user not shown)
Line 3,905:
'''Works with jq, the C implementation of jq'''
 
'''Works with gojq, the RustGo implementation of jq'''
 
jq has no built-in bitwise operations, but the
[https[://rosettacode.org/wiki/Category:Jq/bitwise.jq | "bitwise" module]]
defines
all those needed for the task at hand except for rotations.
Line 3,930:
def task($x; $y):
def isInteger: type == "number" and . == round;
if ($x|isInteger|not) or ($y|isInteger|not) or $x < 0 or $y < 0 or $x > 4294967295 or $y > 4294967295
$x < 0 or $y < 0 or $x > 4294967295 or $y > 4294967295
then "Operands must be in the range of a 32-bit unsigned integer" | error
else
2,442

edits