7
The MMIX architecture is a fairly simple big-endian RISC design. It has a couple of interesting features, one of them is the MXOR
instruction, which is what you should implement.
The MXOR
instruction interprets its arguments (two 64-bit registers) as two 8×8 matrices of bits and performs a matrix multiplication where exclusive-or is used for addition and logical and is used for multiplication.
An argument in binary representation where the leftmost digit is most significant
a0 a1 a2 … a63
is interpreted as a matrix like this:
a0 a1 … a7
a8 a9 … a15
…
a56 a57 … a63
Your task is to write a function, subroutine or similar in a language of choice which can be evoked from a single-letter name (i.e. f(x,y)
) that implements this function. The two arguments of the function shall be of equal implementation-defined unsigned 64 bit integer type, the function shall return a value of the same type.
he winner of this competition is the shortest submission (measured in bytes or characters if the language you use uses a meaningful character encoding). You are encouraged to post a readable commented version of your code in addition to the golfed solution so other's can understand how it works.
3Some test cases would be nice. – Peter Taylor – 2014-08-20T19:27:25.653
1Do the input and outputs need to be numbers that correspond to the bitstrings, or can we use lists of bits? – xnor – 2014-08-20T19:44:12.823
3Am I allowed to use the language's matrix multiplication (if present in the standard lib)? – Howard – 2014-08-20T20:19:05.360
2Put another way, matrix multiplication where the elements of the matrix are in GF(2). – hobbs – 2014-08-20T21:53:51.330
@Howard: why not? – FUZxxl – 2014-08-20T22:13:12.443
@FireFly Please do not alter the specification without asking and without understanding what it's intent is. – FUZxxl – 2014-08-20T22:43:02.650