Skip to content

Commit

Permalink
Merge SVN 4991
Browse files Browse the repository at this point in the history
  • Loading branch information
ddeclerck committed Sep 26, 2024
1 parent d4534a4 commit c693ec0
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 3 deletions.
6 changes: 6 additions & 0 deletions libcob/ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,12 @@

* numeric.c: Changes to speed up COMP-3 handling

2023-02-21 Simon Sobisch <[email protected]>

* numeric.c (cob_decimal_set_packed): backport and extend optimization
from 4.x by Ron - now skipping initial zeros and for huge fields handle
4 digits at once

2023-02-20 Simon Sobisch <[email protected]>

* intrinsic.c, numeric.c: explicit check result of mpz_sgn to 0/!0/1/-1
Expand Down
20 changes: 17 additions & 3 deletions libcob/numeric.c
Original file line number Diff line number Diff line change
Expand Up @@ -1038,8 +1038,22 @@ cob_decimal_set_packed (cob_decimal *d, cob_field *f)
digits = COB_FIELD_DIGITS (f);
if (digits % 2 == nibtest) {
byteval = *p++ & 0x0F;
if (byteval == 0) {
/* Skip leading ZEROs */
while (p < endp
&& *p == 0x00) {
digits -= 2;
p++;
}
}
} else {
byteval = 0;
/* Skip leading ZEROs */
while (p < endp
&& *p == 0x00) {
digits -= 2;
p++;
}
}
if (byteval == 0) {
while (p < endp
Expand Down Expand Up @@ -2746,9 +2760,7 @@ insert_packed_aligned (
*(ptr_byte1 + len1 - 1) &= 0xF0; /* clear sign nibble */
}

if (nibble_cntr == 0) {
compare_len = len1 + byte_cntr;
} else {
if (nibble_cntr != 0) {

/* shift the complete filled buffer one nibble left */
#ifdef ALTERNATIVE_PACKED_SWAP /* should work portably, but is around 20% slower */
Expand Down Expand Up @@ -2798,6 +2810,8 @@ insert_packed_aligned (

#endif
compare_len = len1 + byte_cntr + nibble_cntr;
} else {
compare_len = len1 + byte_cntr;
}

/* insert data2 into initialized buffer at the end */
Expand Down

0 comments on commit c693ec0

Please sign in to comment.