Jatie1 opened a new pull request, #347:
URL: https://github.com/apache/commons-codec/pull/347

   Update methods encodeHex and decodeHex to simplify the code and make it 
slightly more efficient.
   
   encodeHex: don't compute dataOffset + dataLen on every for iteration and 
also standardize nibble high and low using Base16.encode() as inspiration. I 
would say it's easier to read now.
   
   decodeHex: get high and low nibble directly using for loop iterator 
incrementing by 2 (2 char per hex val) and OR them immediately instead of 
getting high nibble, iterating variable, ORing low nibble, iterating variable 
then converting to byte. I think it's far more readable this way.
   
   I tested both with a barebones jmh benchmark and speed is roughly the same 
or very slightly faster than old implementation for both.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@commons.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to