ImagingDataCommons / libdicom

C library for reading DICOM files
https://libdicom.readthedocs.io
MIT License
16 stars 7 forks source link

swap the big switch for a hash in dicom-dict #9

Closed jcupitt closed 2 years ago

jcupitt commented 2 years ago

dicom-dict used a huge switch() statement to look up tags. This patch replaces that with a hash table built on first use. Performance should be better, and we save a lot of code.

I also indented the static decl of the dictionary for consistency, simplified the lookup methods, and swapped the long strcmp checks for another hash table lookup.