4 #include "base/cl_sysdep.h"
7 #include "integer/cl_I.h"
12 #include "cln/number.h"
14 #if (cl_value_len < 32)
16 #include "base/digitseq/cl_DS.h"
20 cl_private_thing cl_I_constructor_from_L (sint32 wert)
22 var uint32 test = wert & minus_bit(cl_value_len-1);
23 // test enthält die Bits, die nicht in den Fixnum-Wert >= 0 reinpassen.
24 if ((test == 0) || (test == (uint32)minus_bit(cl_value_len-1)))
25 { return (cl_private_thing)(cl_combine(cl_FN_tag,wert)); }
27 // trivially generate a Bignum of length one digit
28 var cl_heap_bignum* ptr = allocate_bignum(1);
29 arrayLSref(ptr->data,1,0) = wert;
30 return (cl_private_thing)(ptr);
33 // (dessen Länge bn_minlength <= n <= ceiling(32/intDsize) erfüllt)
34 if (bn_minlength == ceiling(32,intDsize)) {
46 #define IF_LENGTH(i) \
47 if ((bn_minlength <= i) && (i*intDsize <= 32)) \
48 if (!((i+1)*intDsize <= 32) \
49 || ((uint32)wert < (uint32)bitc(i*intDsize-1)) \
54 { var cl_heap_bignum* ptr = allocate_bignum(1);
55 arrayLSref(ptr->data,1,0) = wert;
56 return (cl_private_thing)(ptr);
61 { var cl_heap_bignum* ptr = allocate_bignum(2);
62 arrayLSref(ptr->data,2,0) = (uintD)wert;
63 arrayLSref(ptr->data,2,1) = (uintD)(wert>>intDsize);
64 return (cl_private_thing)(ptr);
69 { var cl_heap_bignum* ptr = allocate_bignum(3);
70 arrayLSref(ptr->data,3,0) = (uintD)wert; wert >>= intDsize;
71 arrayLSref(ptr->data,3,1) = (uintD)wert;
72 arrayLSref(ptr->data,3,2) = (uintD)(wert>>intDsize);
73 return (cl_private_thing)(ptr);
77 { var cl_heap_bignum* ptr = allocate_bignum(4);
78 arrayLSref(ptr->data,4,0) = (uintD)wert; wert >>= intDsize;
79 arrayLSref(ptr->data,4,1) = (uintD)wert; wert >>= intDsize;
80 arrayLSref(ptr->data,4,2) = (uintD)wert;
81 arrayLSref(ptr->data,4,3) = (uintD)(wert>>intDsize);
82 return (cl_private_thing)(ptr);
89 #define IF_LENGTH(i) \
90 if ((bn_minlength <= i) && (i*intDsize <= 32)) \
91 if (!((i+1)*intDsize <= 32) \
92 || ((uint32)wert >= (uint32)(-bitc(i*intDsize-1))) \