Create a table of 256 entries to look up say each byte. The value of an entry in the table will be the thing converted to a number. Then paste the 4 bytes together with shifts to come up with the final number.
Here is an example scaling things down so you get the idea.
The lookup part using 4 bits instead of 8:
0000 = 00
0001 = 01
0010 = 00
0011 = 01
0100 = 10
0101 = 11
...
Looking up say 01010010. Break up into 0101 and 0010. Look those up we get
11, and 00 and paste together: 1100
With a table of 256, you'll need 8 lookups with the corresponding pasting. If you have memory for 2**16 entries then you need only go with four lookups and the pasting is proportionally less too.
The table doesn't have to an even power of two. For example with 1024 entries (2**10) there are 7 lookups. There is just an economy when the table exponent happens to be a power of two (2, 4, 8, 16 or 32).