@@ -62,6 +62,26 @@ function transpose_8x8bit(a::UInt64)
6262return x
6363end
6464
65+
66+ # https://discourse.julialang.org/t/covert-bitarray-to-int64/9193/6
67+ # This was stated to be better than the LLVM intrinsic!
68+ function revbits (z:: UInt64 )
69+ z= (((z& 0xaaaaaaaaaaaaaaaa )>> 1 )| ((z& 0x5555555555555555 )<< 1 ))
70+ z= (((z& 0xcccccccccccccccc )>> 2 )| ((z& 0x3333333333333333 )<< 2 ))
71+ z= (((z& 0xf0f0f0f0f0f0f0f0 )>> 4 )| ((z& 0x0f0f0f0f0f0f0f0f )<< 4 ))
72+ z= (((z& 0xff00ff00ff00ff00 )>> 8 )| ((z& 0x00ff00ff00ff00ff )<< 8 ))
73+ z= (((z& 0xffff0000ffff0000 )>> 16 )| ((z& 0x0000ffff0000ffff )<< 16 ))
74+ z= (((z& 0xffffffff00000000 )>> 32 )| ((z& 0x00000000ffffffff )<< 32 ))
75+ return z
76+ end
77+
78+
6579function Base. permutedims (A:: BitBlockArray{2, UInt64, Tuple{3,3}} )
6680BitBlockArray {2, UInt64, Tuple{3,3}} (transpose_8x8bit (A. x))
6781end
82+
83+
84+ function Base. rot180 (A:: BitBlockArray{2, UInt64, Tuple{3,3}} )
85+ # TODO would work for other sizes, too
86+ BitBlockArray {2, UInt64, Tuple{3,3}} (revbits (A. x))
87+ end