Advertisement
Guest User

Untitled

a guest
Jul 27th, 2017
47
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.44 KB | None | 0 0
  1. #include <stdio.h>
  2.  
  3. unsigned long remove_least (unsigned long x) {
  4.     unsigned long least = 0xF, x1, i = 0, res = 0;
  5.  
  6.     for (x1 = x; x1; x1 >>= 4)
  7.         if ((x1 & 0xF) < least) least = x1 & 0xF;
  8.  
  9.     for (x1 = x; x1; x1 >>= 4)
  10.         if ((x1 & 0xF) != least) {
  11.             res |= ((x1 & 0xF) << i);
  12.             i += 4;
  13.         }
  14.  
  15.     return res;
  16. }
  17.  
  18. int main() {
  19.     printf("%lX\n", remove_least(0x6274272));
  20.     return 0;
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement