12 #include "cln/number.h"
20 cl_private_thing cl_I_constructor_from_UQ (uint64 wert)
22 if ((wert & (sint64)minus_bit(cl_value_len-1)) == 0)
23 // Bits, die nicht in den Fixnum-Wert >= 0 reinpassen.
24 return (cl_private_thing)(cl_combine(cl_FN_tag,wert));
26 // (dessen Länge bn_minlength <= n <= ceiling((32+1)/intDsize) erfüllt)
27 #define UQ_maxlength ceiling(64+1,intDsize)
28 #define IF_LENGTH(i) \
29 if ((bn_minlength <= i) && (i <= UQ_maxlength)) \
30 if (!(i+1 <= UQ_maxlength) \
31 || ((uint64)wert < ((uint64)1 << (i*intDsize-1 < 64 ? i*intDsize-1 : 0))) \
34 { var cl_heap_bignum* ptr = allocate_bignum(1);
35 arrayLSref(ptr->data,1,0) = (uintD)wert;
36 return (cl_private_thing)(ptr);
39 { var cl_heap_bignum* ptr = allocate_bignum(2);
40 arrayLSref(ptr->data,2,0) = (uintD)wert;
42 arrayLSref(ptr->data,2,1) = 0;
44 arrayLSref(ptr->data,2,1) = (uintD)(wert>>intDsize);
46 return (cl_private_thing)(ptr);
50 { var cl_heap_bignum* ptr = allocate_bignum(3);
51 arrayLSref(ptr->data,3,0) = (uintD)wert; wert >>= intDsize;
52 arrayLSref(ptr->data,3,1) = (uintD)wert;
54 arrayLSref(ptr->data,3,2) = 0;
56 arrayLSref(ptr->data,3,2) = (uintD)(wert>>intDsize);
58 return (cl_private_thing)(ptr);
62 { var cl_heap_bignum* ptr = allocate_bignum(4);
63 arrayLSref(ptr->data,4,0) = (uintD)wert; wert >>= intDsize;
64 arrayLSref(ptr->data,4,1) = (uintD)wert; wert >>= intDsize;
65 arrayLSref(ptr->data,4,2) = (uintD)wert;
67 arrayLSref(ptr->data,4,3) = 0;
69 arrayLSref(ptr->data,4,3) = (uintD)(wert>>intDsize);
71 return (cl_private_thing)(ptr);
74 { var cl_heap_bignum* ptr = allocate_bignum(5);
75 arrayLSref(ptr->data,5,0) = (uintD)wert; wert >>= intDsize;
76 arrayLSref(ptr->data,5,1) = (uintD)wert; wert >>= intDsize;
77 arrayLSref(ptr->data,5,2) = (uintD)wert; wert >>= intDsize;
78 arrayLSref(ptr->data,5,3) = (uintD)wert;
80 arrayLSref(ptr->data,5,4) = 0;
82 arrayLSref(ptr->data,5,4) = (uintD)(wert>>intDsize);
84 return (cl_private_thing)(ptr);
88 { var cl_heap_bignum* ptr = allocate_bignum(6);
89 arrayLSref(ptr->data,6,0) = (uintD)wert; wert >>= intDsize;
90 arrayLSref(ptr->data,6,1) = (uintD)wert; wert >>= intDsize;
91 arrayLSref(ptr->data,6,2) = (uintD)wert; wert >>= intDsize;
92 arrayLSref(ptr->data,6,3) = (uintD)wert; wert >>= intDsize;
93 arrayLSref(ptr->data,6,4) = (uintD)wert;
95 arrayLSref(ptr->data,6,5) = 0;
97 arrayLSref(ptr->data,6,5) = (uintD)(wert>>intDsize);
99 return (cl_private_thing)(ptr);
102 { var cl_heap_bignum* ptr = allocate_bignum(7);
103 arrayLSref(ptr->data,7,0) = (uintD)wert; wert >>= intDsize;
104 arrayLSref(ptr->data,7,1) = (uintD)wert; wert >>= intDsize;
105 arrayLSref(ptr->data,7,2) = (uintD)wert; wert >>= intDsize;
106 arrayLSref(ptr->data,7,3) = (uintD)wert; wert >>= intDsize;
107 arrayLSref(ptr->data,7,4) = (uintD)wert; wert >>= intDsize;
108 arrayLSref(ptr->data,7,5) = (uintD)wert;
110 arrayLSref(ptr->data,7,6) = 0;
112 arrayLSref(ptr->data,7,6) = (uintD)(wert>>intDsize);
114 return (cl_private_thing)(ptr);
117 { var cl_heap_bignum* ptr = allocate_bignum(8);
118 arrayLSref(ptr->data,8,0) = (uintD)wert; wert >>= intDsize;
119 arrayLSref(ptr->data,8,1) = (uintD)wert; wert >>= intDsize;
120 arrayLSref(ptr->data,8,2) = (uintD)wert; wert >>= intDsize;
121 arrayLSref(ptr->data,8,3) = (uintD)wert; wert >>= intDsize;
122 arrayLSref(ptr->data,8,4) = (uintD)wert; wert >>= intDsize;
123 arrayLSref(ptr->data,8,5) = (uintD)wert; wert >>= intDsize;
124 arrayLSref(ptr->data,8,6) = (uintD)wert;
126 arrayLSref(ptr->data,8,7) = 0;
128 arrayLSref(ptr->data,8,7) = (uintD)(wert>>intDsize);
130 return (cl_private_thing)(ptr);
133 { var cl_heap_bignum* ptr = allocate_bignum(9);
134 arrayLSref(ptr->data,9,0) = (uintD)wert; wert >>= intDsize;
135 arrayLSref(ptr->data,9,1) = (uintD)wert; wert >>= intDsize;
136 arrayLSref(ptr->data,9,2) = (uintD)wert; wert >>= intDsize;
137 arrayLSref(ptr->data,9,3) = (uintD)wert; wert >>= intDsize;
138 arrayLSref(ptr->data,9,4) = (uintD)wert; wert >>= intDsize;
139 arrayLSref(ptr->data,9,5) = (uintD)wert; wert >>= intDsize;
140 arrayLSref(ptr->data,9,6) = (uintD)wert; wert >>= intDsize;
141 arrayLSref(ptr->data,9,7) = (uintD)wert;
143 arrayLSref(ptr->data,9,8) = 0;
145 arrayLSref(ptr->data,9,8) = (uintD)(wert>>intDsize);
147 return (cl_private_thing)(ptr);