summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog15
-rw-r--r--src/mcpp-predefined.c36
2 files changed, 38 insertions, 13 deletions
diff --git a/ChangeLog b/ChangeLog
index 491f47c..93ad19a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,18 @@
+2026-10-18 Andrey V. Kosteltsev
+
+ * Predefined complex data types:
+ --------------+-------+--------+---------------
+ Data Type | WIDTH | SIZEOF | Components
+ --------------+-------+--------+---------------
+ complex32 | — | — | removed
+ complex64 | 64 | 8 | 2 × real32
+ complex128 | 128 | 16 | 2 × real64
+ complex256 | 256 | 32 | 2 × real128
+ complex512 | 512 | 64 | 2 × real256
+ ... | ... | ... | ...
+ complex65536 | 65536 | 8192 | 2 × real32768
+ --------------+-------+--------+---------------
+
2026-10-12 Andrey V. Kosteltsev
* HOST machine-dependent predefined macros
diff --git a/src/mcpp-predefined.c b/src/mcpp-predefined.c
index 32b1ec4..325ac3b 100644
--- a/src/mcpp-predefined.c
+++ b/src/mcpp-predefined.c
@@ -1,3 +1,4 @@
+
#include <defs.h>
@@ -371,9 +372,9 @@ define_real_family( mcpu_macro_table *table, unsigned bits )
int nb = (int)(bits / 8);
/*
- * Real and Complex language types exist only through the configured
- * MPU_REAL_IO_LIMIT. Complex WIDTH is the width parameter in the language
- * type name (complex128 -> 128), while SIZEOF is twice the Real storage.
+ * Real and Complex types are limited by MPU_REAL_IO_LIMIT. A Complex
+ * width is the total storage width: complex128 consists of two real64
+ * components. The smallest Complex type is complex64.
*/
if( bits > MCPU_CPP_MPU_REAL_IO_LIMIT )
return( 0 );
@@ -383,24 +384,33 @@ define_real_family( mcpu_macro_table *table, unsigned bits )
if( define_utf8(table, name, type) != 0 )
return( -1 );
- snprintf( name, sizeof(name), "__COMPLEX%u_TYPE__", bits );
- snprintf( type, sizeof(type), "complex%u", bits );
- if( define_utf8(table, name, type) != 0 )
- return( -1 );
+ if( bits >= 64 )
+ {
+ snprintf( name, sizeof(name), "__COMPLEX%u_TYPE__", bits );
+ snprintf( type, sizeof(type), "complex%u", bits );
+ if( define_utf8(table, name, type) != 0 )
+ return( -1 );
+ }
snprintf( name, sizeof(name), "__REAL%u_WIDTH__", bits );
if( define_unsigned(table, name, bits) != 0 )
return( -1 );
- snprintf( name, sizeof(name), "__COMPLEX%u_WIDTH__", bits );
- if( define_unsigned(table, name, bits) != 0 )
- return( -1 );
+ if( bits >= 64 )
+ {
+ snprintf( name, sizeof(name), "__COMPLEX%u_WIDTH__", bits );
+ if( define_unsigned(table, name, bits) != 0 )
+ return( -1 );
+ }
snprintf( name, sizeof(name), "__SIZEOF_REAL%u__", bits );
if( define_unsigned(table, name, bits / 8) != 0 )
return( -1 );
- snprintf( name, sizeof(name), "__SIZEOF_COMPLEX%u__", bits );
- if( define_unsigned(table, name, bits / 4) != 0 )
- return( -1 );
+ if( bits >= 64 )
+ {
+ snprintf( name, sizeof(name), "__SIZEOF_COMPLEX%u__", bits );
+ if( define_unsigned(table, name, bits / 8) != 0 )
+ return( -1 );
+ }
/*
* These are compact structural/text-conversion properties. They are