]> git.sur5r.net Git - cc65/commitdiff
Added some code to handle floats/doubles.
authorcuz <cuz@b7a2c559-68d2-44c3-8de9-860c34a00d81>
Fri, 10 Oct 2003 11:39:30 +0000 (11:39 +0000)
committercuz <cuz@b7a2c559-68d2-44c3-8de9-860c34a00d81>
Fri, 10 Oct 2003 11:39:30 +0000 (11:39 +0000)
git-svn-id: svn://svn.cc65.org/cc65/trunk@2487 b7a2c559-68d2-44c3-8de9-860c34a00d81

src/cc65/codegen.h
src/cc65/datatype.c
src/cc65/declare.c

index 15a6872bce4a64976a776f9841e0681ded30cfe0..258bb6b2d859487a2ebca192f3e850ea6b943cbd 100644 (file)
@@ -63,6 +63,7 @@
 #define CF_INT         0x0001  /* Operation on ints */
 #define CF_PTR         CF_INT  /* Alias for readability */
 #define CF_LONG                0x0000  /* Operation on longs */
+#define CF_FLOAT        0x0004  /* Operation on a float */
 
 #define CF_NOKEEP      0x0008  /* Value may get destroyed when storing */
 
index 282385ed7e211c34173ff7dae4609f006ea80aa3..ea9dc6a71013133360c65db89b04406ff5e3fd1b 100644 (file)
@@ -570,6 +570,11 @@ unsigned TypeOf (const type* T)
                case T_ULONG:
                    return CF_LONG | CF_UNSIGNED;
 
+        case T_FLOAT:
+        case T_DOUBLE:      
+            /* These two are identical in the backend */
+            return CF_FLOAT;
+
         case T_FUNC:
            F = DecodePtr (T+1);
            return (F->Flags & FD_VARIADIC)? 0 : CF_FIXARGC;
index 59a618dac423253696cfedd9b3b688d0cad1b416..8bd0b0b87cf81735a6fccfd1eeaff277e4ed3d2a 100644 (file)
@@ -422,7 +422,7 @@ static void ParseTypeSpec (DeclSpec* D, int Default)
                optionalsigned ();
                optionalint ();
                D->Type[0] = T_SHORT;
-               D->Type[1] = T_END;
+               D->Type[1] = T_END;
            }
            break;
 
@@ -460,7 +460,7 @@ static void ParseTypeSpec (DeclSpec* D, int Default)
                    NextToken ();
                    /* FALL THROUGH */
 
-               default:
+               default:
                    D->Type[0] = T_INT;
                    D->Type[1] = T_END;
                    break;
@@ -502,6 +502,18 @@ static void ParseTypeSpec (DeclSpec* D, int Default)
            }
            break;
 
+        case TOK_FLOAT:
+           NextToken ();
+           D->Type[0] = T_FLOAT;
+           D->Type[1] = T_END;
+           break;
+
+        case TOK_DOUBLE:
+           NextToken ();
+           D->Type[0] = T_DOUBLE;
+           D->Type[1] = T_END;
+           break;
+
        case TOK_STRUCT:
        case TOK_UNION:
            StructType = (CurTok.Tok == TOK_STRUCT)? T_STRUCT : T_UNION;