This PR introduces a new mode in asn1scc that optimizes the generated C code for ASN.1 Enumerated types, especially when there are multiple enumerants in the type (e.g., 50 or more).
When the -eee option is present, asn1scc generates more efficient and less verbose code. Instead of generating switch statements, asn1scc generates sorted arrays containing the possible values. Lookups, such as for validation or index retrieval in uPER encoding, are performed using an optimized binary search.
This results in more efficient code generation for large Enumerated types, improving performance and readability.
To use this mode, pass the minimum number of enumerants in an enumerated type to enable this mode as an argument to the -eee option. For example, -eee 50 will enable this mode for enumerated types with 50 or more enumerants.
Optimize Generated C Code for Enumerated Types
This PR introduces a new mode in asn1scc that optimizes the generated C code for ASN.1 Enumerated types, especially when there are multiple enumerants in the type (e.g., 50 or more).
When the
-eee
option is present, asn1scc generates more efficient and less verbose code. Instead of generating switch statements, asn1scc generates sorted arrays containing the possible values. Lookups, such as for validation or index retrieval in uPER encoding, are performed using an optimized binary search.This results in more efficient code generation for large Enumerated types, improving performance and readability.
To use this mode, pass the minimum number of enumerants in an enumerated type to enable this mode as an argument to the
-eee
option. For example,-eee 50
will enable this mode for enumerated types with 50 or more enumerants.