Skip to content

Type-erase Quantity text conversion - #217

Draft
TurkeyMan wants to merge 1 commit into
masterfrom
ow/quantity-text-footprint
Draft

Type-erase Quantity text conversion#217
TurkeyMan wants to merge 1 commit into
masterfrom
ow/quantity-text-footprint

Conversation

@TurkeyMan

Copy link
Copy Markdown
Member

Summary

  • type-erase Quantity text formatting into floating-point and integral backends
  • type-erase parsing and runtime unit-scale conversion
  • preserve templated hard-unit arithmetic so compile-time units and scale factors still fold
  • format signed and unsigned integer quantities exactly instead of routing them through double

Why

Quantity!(T, unit) previously instantiated the complete formatting, parsing, and dynamic scale-conversion machinery for each representation and unit. These are cold runtime operations and gain nothing from hard-unit specialization. Thin typed adapters now pass the value and unit into shared backends, while arithmetic between hard units remains specialized.

An isolated SmartEVSE ESP32 release A/B build reduced the linked image by 416 bytes. That firmware emits only one Quantity formatter and three parsers, so targets using more Quantity text instantiations should gain more deduplication.

Validation

  • uRT Windows unittest configuration builds successfully
  • focused urt.si.quantity suite passes, including hard-unit arithmetic, scaled integer round-trip, long.min, values beyond exact double precision, and ulong.max
  • SmartEVSE ESP32 firmware links successfully; its existing partition-size check still fails after producing the image
  • git diff --check passes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant