* src/pic16/device.c (Pics16[]): added devices 18F2550, 18F4331,
[fw/sdcc] / device / lib / pic16 / libsdcc / char / moduchar.c
index c627ccc91c9b48da04bd06f807ca630c22f29ab6..d362890671a24831a4a7dc19829ba5ee389c31b0 100644 (file)
 
 #include <sdcc-lib.h>
 
-#define MSB_SET(x) ((x >> (8*sizeof(x)-1)) & 1) 
+//#define MSB_SET(x) ((x >> (8*sizeof(x)-1)) & 1) 
+#define MSB_SET(x)     (x & 0x80)
+
 
 unsigned char _moduchar (unsigned char a, unsigned char b) _IL_REENTRANT
 {
   unsigned char count = 0;
     
-    
   while (!MSB_SET(b))
   {
     b <<= 1;
@@ -44,6 +45,7 @@ unsigned char _moduchar (unsigned char a, unsigned char b) _IL_REENTRANT
     }
     count++;
   }
+
   do
   {
     if (a >= b)