Reorganize the code and add new generic parameters so that this unit can be reused in more contexts and in particular provide support for bounded large integers without needing any dynamic memory allocation nor secondary stack.
Move the implementation of To_String to System.Generic_Bignums to allow more code sharing. We now provide bitwise operations on big integers: and, or, shift left, shift right. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * Makefile.rtl (GNATRTL_NONTASKING_OBJS): Add s-shabig.o. * libgnat/s-shabig.ads: New file to share definitions. * libgnat/s-genbig.ads, libgnat/s-genbig.adb: Reorganized to make it more generic and flexible in terms of memory allocation and data structure returned. (To_String): Moved to System.Generic_Bignums to allow sharing this code. (Big_And, Big_Or, Big_Shift_Left, Big_Shift_Right): New. * libgnat/s-bignum.adb, libgnat/s-bignum.ads: Adapt to new System.Generic_Bignums spec. * libgnat/a-nbnbin.adb: Likewise. (To_String): Moved to System.Generic_Bignums to allow sharing this code. * libgnat/a-nbnbre.adb (Normalize): Fix handling of Num = 0 leading to an exception.
patch.diff.gz
Description: application/gzip