Page MenuHome

Cleanup: simplify casting in dna_genfile.c
ClosedPublic

Authored by Campbell Barton (campbellbarton) on Feb 8 2022, 2:07 AM.

Details

Summary

Avoid using the uint64_t as an intermediate cast since it complicates
behavior for signed types (which first need to be cast to an int64_t).

Assign both old_value_i & old_value_f from the original value to avoid the need for different handling of signed/unsigned types.


When looking into integer overflow (see rB9d674d9852db07ade16b521d1c0864b494d232e5), it seems there isn't any advantage in using uint64_t as intermediate storage for signed values.
Added in rB51befa4108128a7bacf7a201046cf7ede999833a.

Diff Detail

Repository
rB Blender
Branch
TEMP-DNA-GENFILE (branched from master)
Build Status
Buildable 20394
Build 20394: arc lint + arc unit

Event Timeline

Campbell Barton (campbellbarton) requested review of this revision.Feb 8 2022, 2:07 AM
Campbell Barton (campbellbarton) created this revision.
Campbell Barton (campbellbarton) retitled this revision from Simplify DNA genfile casting to Cleanup: simplify casting in dna_genfile.c.Feb 8 2022, 2:15 AM
Campbell Barton (campbellbarton) edited the summary of this revision. (Show Details)
Jacques Lucke (JacquesLucke) added inline comments.
source/blender/makesdna/intern/dna_genfile.c
745

For consistency old_value_i should be replaced with value here as well, right?

This revision is now accepted and ready to land.Feb 8 2022, 11:38 AM

Missed SDNA_TYPE_CHAR case