]> git.ipfire.org Git - thirdparty/gcc.git/commit
cobol: Divide-and-conquer conversion from binary to packed-decimal.
authorRobert Dubner <rdubner@symas.com>
Fri, 8 Aug 2025 17:04:53 +0000 (13:04 -0400)
committerRobert Dubner <rdubner@symas.com>
Fri, 8 Aug 2025 17:53:59 +0000 (13:53 -0400)
commit435e09e05c3750cad153c3c6e83134803c22c7f6
tree20b7234399b48fd8bfd0a69bd5a5e5c66bec420b
parente49bdf2c6c3fe9bf1c18b885727423dee5a67c44
cobol: Divide-and-conquer conversion from binary to packed-decimal.

The legacy routine for converting a binary integer to a packed-decimal
representaion peeled two digits at a time from the bottom of an _int128 value.
These changes replace that routine with a divide-and-conquer algorithm that
runs about ten times faster.

libgcobol/ChangeLog:

* libgcobol.cc (int128_to_field): Switch to the new routine.
* stringbin.cc (packed_from_combined): Implement the new routine.
(__gg__binary_to_packed): Likewise.
* stringbin.h (__gg__binary_to_packed): Likewise.
libgcobol/libgcobol.cc
libgcobol/stringbin.cc
libgcobol/stringbin.h