* device/lib/_ltoa.c: 36 bytes less __data mem. This really helps printf_small. 32...
[fw/sdcc] / device / lib / printf_large.c
index cb469b6117e08b3096f323f7310c3898c0d25c7a..f7be3aadd7ba43c0de906922939905e2b1de9af5 100644 (file)
 #define NULL_STRING_LENGTH 6
 #endif
 
+#if defined (SDCC_mcs51) && defined (SDCC_MODEL_SMALL) && !defined (SDCC_STACK_AUTO)
+# define MEM_SPACE_BUF __idata
+# define MEM_SPACE_BUF_PP __idata
+#else
+# define MEM_SPACE_BUF
+# define MEM_SPACE_BUF_PP _AUTOMEM
+#endif
+
 /****************************************************************************/
 
 //typedef char * ptr_t;
@@ -223,7 +231,7 @@ output_float (float f, unsigned char reqWidth,
               signed char reqDecimals,
               BOOL left, BOOL zero, BOOL sign, BOOL space)
 {
-  xdata char fpBuffer[128];
+  __xdata char fpBuffer[128];
 #endif //SDCC_STACK_AUTO
   BOOL negative = 0;
   unsigned long integerPart;
@@ -470,7 +478,7 @@ get_conversion_spec:
       }
 
       if (c=='.') {
-        if (decimals=-1) decimals=0;
+        if (decimals==-1) decimals=0;
         else
           ; // duplicate, ignore
         goto get_conversion_spec;
@@ -657,10 +665,10 @@ get_conversion_spec:
 #endif //USE_FLOATS
       } else if (radix != 0)
       {
-        // Apperently we have to output an integral type
+        // Apparently we have to output an integral type
         // with radix "radix"
-        unsigned char store[6];
-        unsigned char _AUTOMEM *pstore = &store[5];
+        unsigned char MEM_SPACE_BUF store[6];
+        unsigned char MEM_SPACE_BUF_PP *pstore = &store[5];
 
         // store value in byte[0] (LSB) ... byte[3] (MSB)
         if (char_argument)