]> git.ipfire.org Git - thirdparty/gcc.git/commit
cobol: Improve binary conversion from packed-decimal and numeric-display. master trunk
authorRobert Dubner <rdubner@symas.com>
Sat, 20 Jun 2026 01:21:48 +0000 (21:21 -0400)
committerRobert Dubner <rdubner@symas.com>
Sat, 20 Jun 2026 01:44:29 +0000 (21:44 -0400)
commit75fa6b8b6bb07ae6d45709e2ebe885cffdfc3015
tree0a222b89b4079c44540ada797e0284d49974c571
parent9d569367e0e360d736c435b53b448b64d197521c
cobol: Improve binary conversion from packed-decimal and numeric-display.

There are routines that create GENERIC conversion routines that convert
packed-decimal and numeric-display variables to binary.  Some are in
libgcobol, and some have direct GENERIC implementations.  All have been
updated to use faster divide-and-conquer algorithms.

The new routines are ten to twenty times faster than the prior versions.

gcc/cobol/ChangeLog:

* genapi.cc (parser_enter_file): Establish a var_decl for the
common packed-decimal to binary conversion table.
* genutil.cc (digit): Divide-and conquer numeric-display converter.
(num_disp_dive): Likewise.
(pd_dive): Divide-and-conqure packed-decimal converter.
(get_pd_value): Likewise.
(get_binary_value_tree): Use the new routines.
(binary_from_FldNumericBinary):  Divide-and conquer numeric-display
converter.
* genutil.h: Declaration for var_decl_dp2bin.
* move.cc (mh_little_endian): Allow FldPacked as a source.

libgcobol/ChangeLog:

* charmaps.cc: Eliminate rt_encoding_t.
* libgcobol.cc (console_init): Change how __gg__console_encoding is
established.
(initialize_program_state): Likewise.
(get_binary_value_local): Use new conversion algorithms.
(__gg__move): Likewise.
* stringbin.cc (__gg__numeric_display_to_binary):  Likewise.
(digit_rt): Likewise.
(num_disp_dive_rt): Likewise.
(pd_dive_rt): Likewise.
(__gg__packed_to_binary): Likewise.
* stringbin.h (STRINGBIN_H_): Declaration for __gg__dp2bin.
(__gg__numeric_display_to_binary): Use new algorithms.
(__gg__packed_to_binary): Likewise.
gcc/cobol/genapi.cc
gcc/cobol/genutil.cc
gcc/cobol/genutil.h
gcc/cobol/move.cc
libgcobol/charmaps.cc
libgcobol/libgcobol.cc
libgcobol/stringbin.cc
libgcobol/stringbin.h