The function for this is built into the computer.
You can build something like this yourself using XNOR logic gates to check whether two given bit inputs have one being 1 and the other 0 or both being 1s or 0s. Once you can do that for a single bit you can chain it together for a number consisting out of more than 1 bits.
You can build a magnitude cooperator out of logic gates that have two bytes as inputs and three bits for greater lesser and equal as outputs.
In modern computers that is part of the many different built in functions in a chip that can be called via machine code at the lowest level.
Latest Answers