For challenges involving doing something on the bit level.
5
votes
8answers
1k views
Extraction of Bits
Your task is to devise a programme that extracts the bits, in order, represented by the first argument based on the set bits represented by the second argument (the mask).
Formal Definition:
Let ...
9
votes
6answers
840 views
Implement an 8 bit adder
The Challenge
Implement a function which accepts two integers whose values range from 0 - 255 and returns the sum of those integers mod 256. You may only use bitwise negation (~), bitwise or (|), bit ...
7
votes
8answers
461 views
Implement bit-wise matrix multiplication
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 ...
4
votes
1answer
187 views
Recover a bzip2 file
The popular .bz2 compression format is used to store all sorts of things. One of the more interesting features is that it consists of several independently decompressible blocks, allowing recovery of ...
22
votes
47answers
3k views
Sort numbers by binary 1's count
Goal
Write a function or program sort an array of integers by the number of 1's present in their binary representation. No secondary sort condition is necessary.
Example sorted list
(using 16-bit ...
7
votes
9answers
1k views
Arbitrarily Shift Bit Array Represented As Array of 32-bit Integers
Given an array of 32-bit integers which represent a bit array, shift the values by a specified amount in either direction. Positive shifts go to the left and negative values go to the right. This is a ...