From f4e12fadd15690790c13acfb0e32be9303a81132 Mon Sep 17 00:00:00 2001 From: Kresten Krab Thorup Date: Mon, 15 Aug 1994 16:03:36 +0000 Subject: [PATCH] (objc_sizeof_type): Assign from ROUND, don't increment. Remove ; after while to fix infinite loop. Add float and double cases. (objc_alignof_type): Add float and double cases. From-SVN: r7929 --- gcc/objc/encoding.c | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/gcc/objc/encoding.c b/gcc/objc/encoding.c index 479b4a1c6bf..27b4b8a4d0d 100644 --- a/gcc/objc/encoding.c +++ b/gcc/objc/encoding.c @@ -103,6 +103,14 @@ objc_sizeof_type(const char* type) return sizeof(unsigned long); break; + case _C_FLT: + return sizeof(float); + break; + + case _C_DBL: + return sizeof(double); + break; + case _C_PTR: case _C_ATOM: case _C_CHARPTR: @@ -122,10 +130,10 @@ objc_sizeof_type(const char* type) int acc_size = 0; int align; while (*type != _C_STRUCT_E && *type++ != '='); /* skip "=" */ - while (*type != _C_STRUCT_E); + while (*type != _C_STRUCT_E) { align = objc_alignof_type (type); /* padd to alignment */ - acc_size += ROUND (acc_size, align); + acc_size = ROUND (acc_size, align); acc_size += objc_sizeof_type (type); /* add component size */ type = objc_skip_typespec (type); /* skip component */ } @@ -202,6 +210,14 @@ objc_alignof_type(const char* type) return __alignof__(unsigned long); break; + case _C_FLT: + return __alignof__(float); + break; + + case _C_DBL: + return __alignof__(double); + break; + case _C_ATOM: case _C_CHARPTR: return __alignof__(char*); -- 2.30.2