Given a number (call it x), how do you (programatically) find the following multiple of another number (255)? For example, if x is 0, the following multiple of 255 is 255, if x is 700 then the following multiple of 255 is 765.
Is there any way to do it without using a loop? This needs to be fast since it's part of a 6502 emulator (granted the 6502 was like 4 MHz and can be emulated in Javascript, but, still).