ReactOS 0.4.16-dev-716-g2b2bdab
corecrt_internal_big_integer.h
Go to the documentation of this file.
1//
2// corecrt_internal_big_integer.h
3//
4// Copyright (c) Microsoft Corporation. All rights reserved.
5//
6// A lightweight high precision integer type for use by the binary floating
7// point <=> decimal string conversion functions.
8//
9#include <corecrt_internal.h>
10#include <float.h>
11#include <stdint.h>
12
13// CRT_REFACTOR TODO We should be building the whole CRT /O2 /GL. For the moment,
14// just ensure that everything using big_integer is optimized for maximum speed.
15#ifndef _DEBUG
16 #if !defined(_BEGIN_PRAGMA_OPTIMIZE_DISABLE)
17 #define _BEGIN_PRAGMA_OPTIMIZE_DISABLE(flags, bug, reason) \
18 __pragma(optimize(flags, off))
19 #define _BEGIN_PRAGMA_OPTIMIZE_ENABLE(flags, bug, reason) \
20 __pragma(optimize(flags, on))
21 #define _END_PRAGMA_OPTIMIZE() \
22 __pragma(optimize("", on))
23 #endif
24 _BEGIN_PRAGMA_OPTIMIZE_ENABLE("gt", MSFT:4499494, "Optimize for maximum speed")
25#endif
26
27namespace __crt_strtox {
28
29// A lightweight, sufficiently functional high-precision integer type for use in
30// the binary floating point <=> decimal string conversions. We define only the
31// operations (and in some cases parts of operations) that are actually used.
32//
33// We require sufficient precision to represent the reciprocal of the smallest
34// representable value (the smallest denormal, 2^-1074). During parsing, we may
35// also consider up to 768 decimal digits. For this, we require an additional
36// log2(10^768) bits of precision. Finally, we require 54 bits of space for
37// pre-division numerator shifting, because double explicitly stores 52 bits,
38// implicitly stores 1 bit, and we need 1 more bit for rounding.
39//
40// PERFORMANCE NOTE: We intentionally do not initialize the _data array when a
41// big_integer object is constructed. Profiling showed that zero initialization
42// caused a substantial performance hit. Initialization of the _data array is
43// not necessary: all operations on the big_integer type are carefully written
44// to only access elements at indices [0, _used], and all operations correctly
45// update _used as the utilized size increases.
47{
48 __forceinline big_integer() throw()
49 : _used(0)
50 {
51 #ifdef _DEBUG
52 memset(_data, 0xcc, sizeof(_data));
53 #endif
54 }
55
56 __forceinline big_integer(big_integer const& other) throw()
57 : _used(other._used)
58 {
59 memcpy_s(_data, sizeof(_data), other._data, other._used * sizeof(uint32_t));
60 }
61
62 __forceinline big_integer& operator=(big_integer const& other) throw()
63 {
64 _used = other._used;
65 memcpy_s(_data, sizeof(_data), other._data, other._used * sizeof(uint32_t));
66 return *this;
67 }
68
70 {
72 1074 + // 1074 bits required to represent 2^1074
73 2552 + // ceil(log2(10^768))
74 54, // shift space
75
77
79 };
80
81 uint32_t _used; // The number of elements currently in use
82 uint32_t _data[element_count]; // The number, stored in little endian form
83};
84
85__forceinline bool __cdecl operator==(big_integer const& lhs, big_integer const& rhs) throw()
86{
87 if (lhs._used != rhs._used)
88 return false;
89
90 for (uint32_t i = 0; i != lhs._used; ++i)
91 {
92 if (lhs._data[i] != rhs._data[i])
93 return false;
94 }
95
96 return true;
97}
98
99__forceinline bool __cdecl operator!=(big_integer const& lhs, big_integer const& rhs) throw()
100{
101 return !(rhs == lhs);
102}
103
104__forceinline bool __cdecl operator<(big_integer const& lhs, big_integer const& rhs) throw()
105{
106 if (lhs._used > rhs._used)
107 return false;
108
109 if (lhs._used < rhs._used)
110 return true;
111
112 uint32_t i = lhs._used - 1;
113 for (; i != static_cast<uint32_t>(-1) && lhs._data[i] == rhs._data[i]; --i)
114 {
115 // No-op
116 }
117
118 if (i == static_cast<uint32_t>(-1))
119 return false;
120
121 if (lhs._data[i] <= rhs._data[i])
122 return true;
123
124 return false;
125}
126
127__forceinline bool __cdecl operator>=(big_integer const& lhs, big_integer const& rhs) throw()
128{
129 return !(lhs < rhs);
130}
131
133{
134 big_integer x{};
135 x._data[0] = value & 0xffffffff;
136 x._data[1] = value >> 32;
137 x._used = x._data[1] == 0 ? 1 : 2;
138 return x;
139}
140
142{
143 uint32_t const one = 1;
144
145 big_integer x{};
146
147 uint32_t const element_index = power / big_integer::element_bits;
148 uint32_t const bit_index = power % big_integer::element_bits;
149
150 memset(x._data, 0, element_index * sizeof(uint32_t));
151 x._data[element_index] = (one << bit_index);
152 x._used = element_index + 1;
153
154 return x;
155}
156
157__forceinline bool __cdecl is_zero(big_integer const& value) throw()
158{
159 return value._used == 0;
160}
161
162__forceinline uint32_t __cdecl bit_scan_reverse(uint32_t const value) throw()
163{
164 unsigned long index = 0;
166 return index + 1;
167 return 0;
168}
169
170__forceinline uint32_t __cdecl bit_scan_reverse(uint64_t const value) throw()
171{
172 if (value > UINT32_MAX)
173 {
174 return bit_scan_reverse(reinterpret_cast<uint32_t const*>(&value)[1]) + 32;
175 }
176 else
177 {
178 return bit_scan_reverse(reinterpret_cast<uint32_t const*>(&value)[0]);
179 }
180}
181
182__forceinline uint32_t __cdecl bit_scan_reverse(big_integer const& x) throw()
183{
184 if (x._used == 0)
185 {
186 return 0;
187 }
188
189 return (x._used - 1) * big_integer::element_bits + bit_scan_reverse(x._data[x._used - 1]);
190}
191
192// Shifts the high precision integer x by n bits to the left. Returns true if
193// the left shift was successful; false if it overflowed. When overflow occurs,
194// the high precision integer is reset to zero.
195__forceinline bool __cdecl shift_left(big_integer& x, uint32_t const n) throw()
196{
197 uint32_t const unit_shift = n / big_integer::element_bits;
198 uint32_t const bit_shift = n % big_integer::element_bits;
199
200 uint64_t const one = 1;
201
202 uint32_t const msb_bits = bit_shift;
203 uint32_t const lsb_bits = big_integer::element_bits - msb_bits;
204
205 uint32_t const lsb_mask = static_cast<uint32_t>((one << lsb_bits) - one);
206 uint32_t const msb_mask = ~lsb_mask;
207
208 bool const bit_shifts_into_next_unit = bit_shift > (big_integer::element_bits - bit_scan_reverse(x._data[x._used - 1]));
209
210 bool const unit_shift_will_overflow = x._used + unit_shift > big_integer::element_count;
211
212 if (unit_shift_will_overflow)
213 {
214 x = big_integer{};
215 return false;
216 }
217
218 uint32_t const new_used =
219 x._used + unit_shift + static_cast<uint32_t>(bit_shifts_into_next_unit);
220
221 if (new_used > big_integer::element_count)
222 {
223 x = big_integer{};
224 return false;
225 }
226
227 for (uint32_t destination_index = new_used - 1; destination_index != unit_shift - 1; --destination_index)
228 {
229 uint32_t const upper_source_index = destination_index - unit_shift;
230 uint32_t const lower_source_index = destination_index - unit_shift - 1;
231
232 uint32_t const upper_source = upper_source_index < x._used ? x._data[upper_source_index] : 0;
233 uint32_t const lower_source = lower_source_index < x._used ? x._data[lower_source_index] : 0;
234
235 uint32_t const shifted_upper_source = (upper_source & lsb_mask) << msb_bits;
236 uint32_t const shifted_lower_source = (lower_source & msb_mask) >> lsb_bits;
237
238 uint32_t const combined_shifted_source = shifted_upper_source | shifted_lower_source;
239
240 x._data[destination_index] = combined_shifted_source;
241 }
242
243 for (uint32_t destination_index = 0; destination_index != unit_shift; ++destination_index)
244 {
245 x._data[destination_index] = 0;
246 }
247
248 x._used = new_used;
249
250 return true;
251}
252
253// Adds a 32-bit value to the high-precision integer x. Returns true if the
254// addition was successful; false if it overflowed. When overflow occurs, the
255// high precision integer is reset to zero.
256__forceinline bool __cdecl add(big_integer& x, uint32_t const value) throw()
257{
258 if (value == 0)
259 {
260 return true;
261 }
262
263 uint32_t carry = value;
264 for (uint32_t i = 0; i != x._used; ++i)
265 {
266 uint64_t const result = static_cast<uint64_t>(x._data[i]) + carry;
267 x._data[i] = static_cast<uint32_t>(result);
268 carry = static_cast<uint32_t>(result >> 32);
269 }
270
271 if (carry != 0)
272 {
273 if (x._used < big_integer::element_count)
274 {
275 x._data[x._used] = carry;
276 ++x._used;
277 }
278 else
279 {
280 x = big_integer{};
281 return false;
282 }
283 }
284
285 return true;
286}
287
289 uint32_t& u1,
290 uint32_t const u2,
291 uint32_t const u_carry
292 ) throw()
293{
294 uint64_t const uu = static_cast<uint64_t>(u1) + u2 + u_carry;
295 u1 = static_cast<uint32_t>(uu);
296 return static_cast<uint32_t>(uu >> 32);
297}
298
300 uint32_t& u_add,
301 uint32_t const u_mul_1,
302 uint32_t const u_mul_2,
303 uint32_t const u_carry
304 ) throw()
305{
306 uint64_t const uu_res = static_cast<uint64_t>(u_mul_1) * u_mul_2 + u_add + u_carry;
307 u_add = static_cast<uint32_t>(uu_res);
308 return reinterpret_cast<unsigned const*>(&uu_res)[1];
309}
310
312 _Inout_updates_all_(multiplicand_count) uint32_t* const multiplicand,
313 uint32_t const multiplicand_count,
314 uint32_t const multiplier
315 ) throw()
316{
317 uint32_t carry = 0;
318 for (uint32_t i = 0; i != multiplicand_count; ++i)
319 {
320 uint64_t const result = static_cast<uint64_t>(multiplicand[i]) * multiplier + carry;
321 multiplicand[i] = static_cast<uint32_t>(result);
322 carry = static_cast<uint32_t>(result >> 32);
323 }
324
325 return carry;
326}
327
328
329// Multiplies the high precision multiplicand by a 32-bit multiplier. Returns
330// true if the multiplication was successful; false if it overflowed. When
331// overflow occurs, the multiplicand is reset to zero.
332__forceinline bool __cdecl multiply(big_integer& multiplicand, uint32_t const multiplier) throw()
333{
334 if (multiplier == 0)
335 {
336 multiplicand = big_integer{};
337 return true;
338 }
339
340 if (multiplier == 1)
341 {
342 return true;
343 }
344
345 if (multiplicand._used == 0)
346 {
347 return true;
348 }
349
350 uint32_t const carry = multiply_core(multiplicand._data, multiplicand._used, multiplier);
351 if (carry != 0)
352 {
353 if (multiplicand._used < big_integer::element_count)
354 {
355 multiplicand._data[multiplicand._used] = carry;
356 ++multiplicand._used;
357 }
358 else
359 {
360 multiplicand = big_integer{};
361 return false;
362 }
363 }
364
365 return true;
366}
367
368// This high precision integer division implementation was translated from the
369// implementation of System.Numerics.BigIntegerBuilder.Mul in the .NET Framework
370// sources. It multiplies the multiplicand by the multiplier and returns true
371// if the multiplication was successful; false if it overflowed. When overflow
372// occurs, the multiplicand is reset to zero.
373__forceinline bool __cdecl multiply(big_integer& multiplicand, big_integer const& multiplier) throw()
374{
375 if (multiplier._used <= 1)
376 {
377 return multiply(multiplicand, multiplier._data[0]);
378 }
379
380 if (multiplicand._used <= 1)
381 {
382 uint32_t const small_multiplier = multiplicand._data[0];
383 multiplicand = multiplier;
384 return multiply(multiplicand, small_multiplier);
385 }
386
387 // We prefer more iterations on the inner loop and fewer on the outer:
388 bool const multiplier_is_shorter = multiplier._used < multiplicand._used;
389 uint32_t const* const rgu1 = multiplier_is_shorter ? multiplier._data : multiplicand._data;
390 uint32_t const* const rgu2 = multiplier_is_shorter ? multiplicand._data : multiplier._data;
391
392 uint32_t const cu1 = multiplier_is_shorter ? multiplier._used : multiplicand._used;
393 uint32_t const cu2 = multiplier_is_shorter ? multiplicand._used : multiplier._used;
394
396 for (uint32_t iu1 = 0; iu1 != cu1; ++iu1)
397 {
398 uint32_t const u_cur = rgu1[iu1];
399 if (u_cur == 0)
400 {
401 if (iu1 == result._used)
402 {
403 result._data[iu1] = 0;
404 result._used = iu1 + 1;
405 }
406
407 continue;
408 }
409
410 uint32_t u_carry = 0;
411 uint32_t iu_res = iu1;
412 for (uint32_t iu2 = 0; iu2 != cu2 && iu_res != big_integer::element_count; ++iu2, ++iu_res)
413 {
414 if (iu_res == result._used)
415 {
416 result._data[iu_res] = 0;
417 result._used = iu_res + 1;
418 }
419
420 u_carry = add_multiply_carry(result._data[iu_res], u_cur, rgu2[iu2], u_carry);
421 }
422
423 while (u_carry != 0 && iu_res != big_integer::element_count)
424 {
425 if (iu_res == result._used)
426 {
427 result._data[iu_res] = 0;
428 result._used = iu_res + 1;
429 }
430
431 u_carry = add_carry(result._data[iu_res++], 0, u_carry);
432 }
433
434 if (iu_res == big_integer::element_count)
435 {
436 multiplicand = big_integer{};
437 return false;
438 }
439 }
440
441 // Store the result in the multiplicand and compute the actual number of
442 // elements used:
443 multiplicand = result;
444 return true;
445}
446
447// Multiplies the high precision integer x by 10^power. Returns true if the
448// multiplication was successful; false if it overflowed. When overflow occurs,
449// the high precision integer is reset to zero.
450__forceinline bool __cdecl multiply_by_power_of_ten(big_integer& x, uint32_t const power) throw()
451{
452 // To improve performance, we use a table of precomputed powers of ten, from
453 // 10^10 through 10^380, in increments of ten. In its unpacked form, as an
454 // array of big_integer objects, this table consists mostly of zero elements.
455 // Thus, we store the table in a packed form, trimming leading and trailing
456 // zero elements. We provide an index that is used to unpack powers from the
457 // table, using the function that appears after this function in this file.
458 //
459 // The minimum value representable with double precision is 5E-324. With
460 // this table we can thus compute most multiplications with a single multiply.
461 static uint32_t const large_power_data[] =
462 {
463 0x540be400, 0x00000002, 0x63100000, 0x6bc75e2d, 0x00000005, 0x40000000, 0x4674edea, 0x9f2c9cd0,
464 0x0000000c, 0xb9f56100, 0x5ca4bfab, 0x6329f1c3, 0x0000001d, 0xb5640000, 0xc40534fd, 0x926687d2,
465 0x6c3b15f9, 0x00000044, 0x10000000, 0x946590d9, 0xd762422c, 0x9a224501, 0x4f272617, 0x0000009f,
466 0x07950240, 0x245689c1, 0xc5faa71c, 0x73c86d67, 0xebad6ddc, 0x00000172, 0xcec10000, 0x63a22764,
467 0xefa418ca, 0xcdd17b25, 0x6bdfef70, 0x9dea3e1f, 0x0000035f, 0xe4000000, 0xcdc3fe6e, 0x66bc0c6a,
468 0x2e391f32, 0x5a450203, 0x71d2f825, 0xc3c24a56, 0x000007da, 0xa82e8f10, 0xaab24308, 0x8e211a7c,
469 0xf38ace40, 0x84c4ce0b, 0x7ceb0b27, 0xad2594c3, 0x00001249, 0xdd1a4000, 0xcc9f54da, 0xdc5961bf,
470 0xc75cabab, 0xf505440c, 0xd1bc1667, 0xfbb7af52, 0x608f8d29, 0x00002a94, 0x21000000, 0x17bb8a0c,
471 0x56af8ea4, 0x06479fa9, 0x5d4bb236, 0x80dc5fe0, 0xf0feaa0a, 0xa88ed940, 0x6b1a80d0, 0x00006323,
472 0x324c3864, 0x8357c796, 0xe44a42d5, 0xd9a92261, 0xbd3c103d, 0x91e5f372, 0xc0591574, 0xec1da60d,
473 0x102ad96c, 0x0000e6d3, 0x1e851000, 0x6e4f615b, 0x187b2a69, 0x0450e21c, 0x2fdd342b, 0x635027ee,
474 0xa6c97199, 0x8e4ae916, 0x17082e28, 0x1a496e6f, 0x0002196e, 0x32400000, 0x04ad4026, 0xf91e7250,
475 0x2994d1d5, 0x665bcdbb, 0xa23b2e96, 0x65fa7ddb, 0x77de53ac, 0xb020a29b, 0xc6bff953, 0x4b9425ab,
476 0x0004e34d, 0xfbc32d81, 0x5222d0f4, 0xb70f2850, 0x5713f2f3, 0xdc421413, 0xd6395d7d, 0xf8591999,
477 0x0092381c, 0x86b314d6, 0x7aa577b9, 0x12b7fe61, 0x000b616a, 0x1d11e400, 0x56c3678d, 0x3a941f20,
478 0x9b09368b, 0xbd706908, 0x207665be, 0x9b26c4eb, 0x1567e89d, 0x9d15096e, 0x7132f22b, 0xbe485113,
479 0x45e5a2ce, 0x001a7f52, 0xbb100000, 0x02f79478, 0x8c1b74c0, 0xb0f05d00, 0xa9dbc675, 0xe2d9b914,
480 0x650f72df, 0x77284b4c, 0x6df6e016, 0x514391c2, 0x2795c9cf, 0xd6e2ab55, 0x9ca8e627, 0x003db1a6,
481 0x40000000, 0xf4ecd04a, 0x7f2388f0, 0x580a6dc5, 0x43bf046f, 0xf82d5dc3, 0xee110848, 0xfaa0591c,
482 0xcdf4f028, 0x192ea53f, 0xbcd671a0, 0x7d694487, 0x10f96e01, 0x791a569d, 0x008fa475, 0xb9b2e100,
483 0x8288753c, 0xcd3f1693, 0x89b43a6b, 0x089e87de, 0x684d4546, 0xfddba60c, 0xdf249391, 0x3068ec13,
484 0x99b44427, 0xb68141ee, 0x5802cac3, 0xd96851f1, 0x7d7625a2, 0x014e718d, 0xfb640000, 0xf25a83e6,
485 0x9457ad0f, 0x0080b511, 0x2029b566, 0xd7c5d2cf, 0xa53f6d7d, 0xcdb74d1c, 0xda9d70de, 0xb716413d,
486 0x71d0ca4e, 0xd7e41398, 0x4f403a90, 0xf9ab3fe2, 0x264d776f, 0x030aafe6, 0x10000000, 0x09ab5531,
487 0xa60c58d2, 0x566126cb, 0x6a1c8387, 0x7587f4c1, 0x2c44e876, 0x41a047cf, 0xc908059e, 0xa0ba063e,
488 0xe7cfc8e8, 0xe1fac055, 0xef0144b2, 0x24207eb0, 0xd1722573, 0xe4b8f981, 0x071505ae, 0x7a3b6240,
489 0xcea45d4f, 0x4fe24133, 0x210f6d6d, 0xe55633f2, 0x25c11356, 0x28ebd797, 0xd396eb84, 0x1e493b77,
490 0x471f2dae, 0x96ad3820, 0x8afaced1, 0x4edecddb, 0x5568c086, 0xb2695da1, 0x24123c89, 0x107d4571,
491 0x1c410000, 0x6e174a27, 0xec62ae57, 0xef2289aa, 0xb6a2fbdd, 0x17e1efe4, 0x3366bdf2, 0x37b48880,
492 0xbfb82c3e, 0x19acde91, 0xd4f46408, 0x35ff6a4e, 0x67566a0e, 0x40dbb914, 0x782a3bca, 0x6b329b68,
493 0xf5afc5d9, 0x266469bc, 0xe4000000, 0xfb805ff4, 0xed55d1af, 0x9b4a20a8, 0xab9757f8, 0x01aefe0a,
494 0x4a2ca67b, 0x1ebf9569, 0xc7c41c29, 0xd8d5d2aa, 0xd136c776, 0x93da550c, 0x9ac79d90, 0x254bcba8,
495 0x0df07618, 0xf7a88809, 0x3a1f1074, 0xe54811fc, 0x59638ead, 0x97cbe710, 0x26d769e8, 0xb4e4723e,
496 0x5b90aa86, 0x9c333922, 0x4b7a0775, 0x2d47e991, 0x9a6ef977, 0x160b40e7, 0x0c92f8c4, 0xf25ff010,
497 0x25c36c11, 0xc9f98b42, 0x730b919d, 0x05ff7caf, 0xb0432d85, 0x2d2b7569, 0xa657842c, 0xd01fef10,
498 0xc77a4000, 0xe8b862e5, 0x10d8886a, 0xc8cd98e5, 0x108955c5, 0xd059b655, 0x58fbbed4, 0x03b88231,
499 0x034c4519, 0x194dc939, 0x1fc500ac, 0x794cc0e2, 0x3bc980a1, 0xe9b12dd1, 0x5e6d22f8, 0x7b38899a,
500 0xce7919d8, 0x78c67672, 0x79e5b99f, 0xe494034e, 0x00000001, 0xa1000000, 0x6c5cd4e9, 0x9be47d6f,
501 0xf93bd9e7, 0x77626fa1, 0xc68b3451, 0xde2b59e8, 0xcf3cde58, 0x2246ff58, 0xa8577c15, 0x26e77559,
502 0x17776753, 0xebe6b763, 0xe3fd0a5f, 0x33e83969, 0xa805a035, 0xf631b987, 0x211f0f43, 0xd85a43db,
503 0xab1bf596, 0x683f19a2, 0x00000004, 0xbe7dfe64, 0x4bc9042f, 0xe1f5edb0, 0x8fa14eda, 0xe409db73,
504 0x674fee9c, 0xa9159f0d, 0xf6b5b5d6, 0x7338960e, 0xeb49c291, 0x5f2b97cc, 0x0f383f95, 0x2091b3f6,
505 0xd1783714, 0xc1d142df, 0x153e22de, 0x8aafdf57, 0x77f5e55f, 0xa3e7ca8b, 0x032f525b, 0x42e74f3d,
506 0x0000000a, 0xf4dd1000, 0x5d450952, 0xaeb442e1, 0xa3b3342e, 0x3fcda36f, 0xb4287a6e, 0x4bc177f7,
507 0x67d2c8d0, 0xaea8f8e0, 0xadc93b67, 0x6cc856b3, 0x959d9d0b, 0x5b48c100, 0x4abe8a3d, 0x52d936f4,
508 0x71dbe84d, 0xf91c21c5, 0x4a458109, 0xd7aad86a, 0x08e14c7c, 0x759ba59c, 0xe43c8800, 0x00000017,
509 0x92400000, 0x04f110d4, 0x186472be, 0x8736c10c, 0x1478abfb, 0xfc51af29, 0x25eb9739, 0x4c2b3015,
510 0xa1030e0b, 0x28fe3c3b, 0x7788fcba, 0xb89e4358, 0x733de4a4, 0x7c46f2c2, 0x8f746298, 0xdb19210f,
511 0x2ea3b6ae, 0xaa5014b2, 0xea39ab8d, 0x97963442, 0x01dfdfa9, 0xd2f3d3fe, 0xa0790280, 0x00000037,
512 0x509c9b01, 0xc7dcadf1, 0x383dad2c, 0x73c64d37, 0xea6d67d0, 0x519ba806, 0xc403f2f8, 0xa052e1a2,
513 0xd710233a, 0x448573a9, 0xcf12d9ba, 0x70871803, 0x52dc3a9b, 0xe5b252e8, 0x0717fb4e, 0xbe4da62f,
514 0x0aabd7e1, 0x8c62ed4f, 0xceb9ec7b, 0xd4664021, 0xa1158300, 0xcce375e6, 0x842f29f2, 0x00000081,
515 0x7717e400, 0xd3f5fb64, 0xa0763d71, 0x7d142fe9, 0x33f44c66, 0xf3b8f12e, 0x130f0d8e, 0x734c9469,
516 0x60260fa8, 0x3c011340, 0xcc71880a, 0x37a52d21, 0x8adac9ef, 0x42bb31b4, 0xd6f94c41, 0xc88b056c,
517 0xe20501b8, 0x5297ed7c, 0x62c361c4, 0x87dad8aa, 0xb833eade, 0x94f06861, 0x13cc9abd, 0x8dc1d56a,
518 0x0000012d, 0x13100000, 0xc67a36e8, 0xf416299e, 0xf3493f0a, 0x77a5a6cf, 0xa4be23a3, 0xcca25b82,
519 0x3510722f, 0xbe9d447f, 0xa8c213b8, 0xc94c324e, 0xbc9e33ad, 0x76acfeba, 0x2e4c2132, 0x3e13cd32,
520 0x70fe91b4, 0xbb5cd936, 0x42149785, 0x46cc1afd, 0xe638ddf8, 0x690787d2, 0x1a02d117, 0x3eb5f1fe,
521 0xc3b9abae, 0x1c08ee6f, 0x000002be, 0x40000000, 0x8140c2aa, 0x2cf877d9, 0x71e1d73d, 0xd5e72f98,
522 0x72516309, 0xafa819dd, 0xd62a5a46, 0x2a02dcce, 0xce46ddfe, 0x2713248d, 0xb723d2ad, 0xc404bb19,
523 0xb706cc2b, 0x47b1ebca, 0x9d094bdc, 0xc5dc02ca, 0x31e6518e, 0x8ec35680, 0x342f58a8, 0x8b041e42,
524 0xfebfe514, 0x05fffc13, 0x6763790f, 0x66d536fd, 0xb9e15076, 0x00000662, 0x67b06100, 0xd2010a1a,
525 0xd005e1c0, 0xdb12733b, 0xa39f2e3f, 0x61b29de2, 0x2a63dce2, 0x942604bc, 0x6170d59b, 0xc2e32596,
526 0x140b75b9, 0x1f1d2c21, 0xb8136a60, 0x89d23ba2, 0x60f17d73, 0xc6cad7df, 0x0669df2b, 0x24b88737,
527 0x669306ed, 0x19496eeb, 0x938ddb6f, 0x5e748275, 0xc56e9a36, 0x3690b731, 0xc82842c5, 0x24ae798e,
528 0x00000ede, 0x41640000, 0xd5889ac1, 0xd9432c99, 0xa280e71a, 0x6bf63d2e, 0x8249793d, 0x79e7a943,
529 0x22fde64a, 0xe0d6709a, 0x05cacfef, 0xbd8da4d7, 0xe364006c, 0xa54edcb3, 0xa1a8086e, 0x748f459e,
530 0xfc8e54c8, 0xcc74c657, 0x42b8c3d4, 0x57d9636e, 0x35b55bcc, 0x6c13fee9, 0x1ac45161, 0xb595badb,
531 0xa1f14e9d, 0xdcf9e750, 0x07637f71, 0xde2f9f2b, 0x0000229d, 0x10000000, 0x3c5ebd89, 0xe3773756,
532 0x3dcba338, 0x81d29e4f, 0xa4f79e2c, 0xc3f9c774, 0x6a1ce797, 0xac5fe438, 0x07f38b9c, 0xd588ecfa,
533 0x3e5ac1ac, 0x85afccce, 0x9d1f3f70, 0xe82d6dd3, 0x177d180c, 0x5e69946f, 0x648e2ce1, 0x95a13948,
534 0x340fe011, 0xb4173c58, 0x2748f694, 0x7c2657bd, 0x758bda2e, 0x3b8090a0, 0x2ddbb613, 0x6dcf4890,
535 0x24e4047e, 0x00005099,
536 };
537
538 struct unpack_index
539 {
540 uint16_t _offset; // The offset of this power's initial byte in the array
541 uint8_t _zeroes; // The number of omitted leading zero elements
542 uint8_t _size; // The number of elements present for this power
543 };
544
545 static unpack_index const large_power_indices[] =
546 {
547 { 0, 0, 2 }, { 2, 0, 3 }, { 5, 0, 4 }, { 9, 1, 4 },
548 { 13, 1, 5 }, { 18, 1, 6 }, { 24, 2, 6 }, { 30, 2, 7 },
549 { 37, 2, 8 }, { 45, 3, 8 }, { 53, 3, 9 }, { 62, 3, 10 },
550 { 72, 4, 10 }, { 82, 4, 11 }, { 93, 4, 12 }, { 105, 5, 12 },
551 { 117, 5, 13 }, { 130, 5, 14 }, { 144, 5, 15 }, { 159, 6, 15 },
552 { 174, 6, 16 }, { 190, 6, 17 }, { 207, 7, 17 }, { 224, 7, 18 },
553 { 242, 7, 19 }, { 261, 8, 19 }, { 280, 8, 21 }, { 301, 8, 22 },
554 { 323, 9, 22 }, { 345, 9, 23 }, { 368, 9, 24 }, { 392, 10, 24 },
555 { 416, 10, 25 }, { 441, 10, 26 }, { 467, 10, 27 }, { 494, 11, 27 },
556 { 521, 11, 28 }, { 549, 11, 29 },
557 };
558
559 uint32_t large_power = power / 10;
560 while (large_power != 0)
561 {
562 uint32_t const current_power = large_power > _countof(large_power_indices)
563 ? _countof(large_power_indices)
564 : large_power;
565
566 unpack_index const& index = large_power_indices[current_power - 1];
567 big_integer multiplier{};
568 multiplier._used = index._size + index._zeroes;
569
570 uint32_t const* const source = large_power_data + index._offset;
571
572 memset(multiplier._data, 0, index._zeroes * sizeof(uint32_t));
573 memcpy(multiplier._data + index._zeroes, source, index._size * sizeof(uint32_t));
574
575 if (!multiply(x, multiplier))
576 {
577 x = big_integer{};
578 return false;
579 }
580
581 large_power -= current_power;
582 }
583
584 static uint32_t const small_powers_of_ten[9] =
585 {
586 10,
587 100,
588 1000,
589 1000 * 10,
590 1000 * 100,
591 1000 * 1000,
592 1000 * 1000 * 10,
593 1000 * 1000 * 100,
594 1000 * 1000 * 1000
595 };
596
597 uint32_t const small_power = power % 10;
598 if (small_power != 0)
599 {
600 if (!multiply(x, small_powers_of_ten[small_power - 1]))
601 {
602 return false;
603 }
604 }
605
606 return true;
607}
608
609// The following non-compiled functions are the generators for the big powers of
610// ten table found in multiply_by_power_of_ten(). This code is provided for
611// future use if the table needs to be amended. Do not remove this code.
612/*
613uint32_t count_leading_zeroes(big_integer const& x)
614{
615 for (uint32_t i = 0; i != x._used; ++i)
616 {
617 if (x._data[i] != 0)
618 return i;
619 }
620
621 return 0;
622}
623
624void generate_table()
625{
626 std::vector<uint32_t> elements;
627 std::vector<unpack_index> indices;
628
629 for (uint32_t i = 10; i != 390; i += 10)
630 {
631 big_integer x = make_big_integer(1);
632 for (uint32_t j = 0; j != i; ++j)
633 {
634 multiply(x, 10);
635 }
636
637 unpack_index index{};
638 index._offset = elements.size();
639 index._zeroes = count_leading_zeroes(x);
640 index._size = x._used - index._zeroes;
641
642 for (uint32_t j = index._zeroes; j != x._used; ++j)
643 {
644 elements.push_back(x._data[j]);
645 }
646 indices.push_back(index);
647 }
648
649 printf("static uint32_t const large_power_data[] = \n{");
650 for (uint32_t i = 0; i != elements.size(); ++i)
651 {
652 printf("%s0x%08x, ", i % 8 == 0 ? "\n " : "", elements[i]);
653 }
654 printf("\n};\n");
655
656 printf("static unpack_index const large_power_indices[] = \n{\n");
657 for (uint32_t i = 0; i != indices.size(); ++i)
658 {
659 printf("%s{ %4u, %2u, %2u }, ",
660 i % 4 == 0 ? "\n " : "",
661 indices[i]._offset,
662 indices[i]._zeroes,
663 indices[i]._size);
664 }
665 printf("};\n");
666}
667*/
668
669// Computes the number of zeroes higher than the most significant set bit in 'u'
671{
672 unsigned long result;
673 return _BitScanReverse(&result, u) ? 31 - result : 32;
674}
675
676// PERFORMANCE NOTE: On x86, for multiplication of a 64-bit unsigned integer by
677// a 32-bit unsigned integer, the compiler will generate a call to _allmul. For
678// division-heavy conversions, the inline assembly version presented here gives a
679// 10% overall performance improvement (not 10% faster division--10% faster total).
680// This function [1] uses only two 32-bit multiplies instead of the three required
681// for general 64-bit x 64-bit multiplication, and [2] is inlineable, allowing the
682// compile to elide the extreme overhead of calling the _allmul function.
683#if defined(_M_IX86) && !defined(_M_HYBRID_X86_ARM64)
684 __forceinline uint64_t __cdecl multiply_64_32(
685 uint64_t const multiplicand,
686 uint32_t const multiplier
687 ) throw()
688 {
689 #ifdef _MSC_VER
690 __asm
691 {
692 mov eax, dword ptr [multiplicand + 4]
693 mul multiplier
694
695 mov ecx, eax
696
697 mov eax, dword ptr [multiplicand]
698 mul multiplier
699
700 add edx, ecx
701 }
702 #else // ^^^ _MSC_VER ^^^ // vvv !_MSC_VER vvv //
704 __asm__(
705 "mull %[multiplier]\n"
706 "movl %%eax, %%ecx\n"
707 "movl %[multiplicand_lo], %%eax\n"
708 "mull %[multiplier]\n"
709 "addl %%ecx, %%edx\n"
710 : "=A" (retval)
711 : [multiplicand_hi] "a" ((uint32_t)((multiplicand >> 32) & 0xFFFFFFFF)),
712 [multiplicand_lo] "rm" ((uint32_t)((multiplicand >> 0) & 0xFFFFFFFF)),
713 [multiplier] "rm" (multiplier)
714 : "ecx" );
715 return retval;
716 #endif // !_MSC_VER
717 }
718#else
720 uint64_t const multiplicand,
721 uint32_t const multiplier
722 ) throw()
723 {
724 return multiplicand * multiplier;
725 }
726#endif
727
728// This high precision integer division implementation was translated from the
729// implementation of System.Numerics.BigIntegerBuilder.ModDivCore in the .NET
730// Framework sources. It computes both quotient and remainder: the remainder
731// is stored in the numerator argument, and the least significant 32 bits of the
732// quotient are returned from the function.
734 big_integer & numerator,
735 big_integer const& denominator
736 ) throw()
737{
738 // If the numerator is zero, then both the quotient and remainder are zero:
739 if (numerator._used == 0)
740 {
741 return 0;
742 }
743
744 // If the denominator is zero, then uh oh. We can't divide by zero:
745 if (denominator._used == 0)
746 {
747 _ASSERTE(("Division by zero", false));
748 return 0;
749 }
750
751 uint32_t max_numerator_element_index = numerator._used - 1;
752 uint32_t max_denominator_element_index = denominator._used - 1;
753
754 // The numerator and denominator are both nonzero. If the denominator is
755 // only one element wide, we can take the fast route:
756 if (max_denominator_element_index == 0)
757 {
758 uint32_t const small_denominator = denominator._data[0];
759
760 if (small_denominator == 1)
761 {
762 uint32_t const quotient = numerator._data[0];
763 numerator = big_integer{};
764 return quotient;
765 }
766
767 if (max_numerator_element_index == 0)
768 {
769 uint32_t const small_numerator = numerator._data[0];
770
771 numerator = big_integer{};
772 numerator._data[0] = small_numerator % small_denominator;
773 numerator._used = numerator._data[0] > 0 ? 1 : 0;
774 return small_numerator / small_denominator;
775 }
776
777 // We count down in the next loop, so the last assignment to quotient
778 // will be the correct one.
779 uint64_t quotient = 0;
780
781 uint64_t uu = 0;
782 for (uint32_t iv = max_numerator_element_index; iv != static_cast<uint32_t>(-1); --iv)
783 {
784 uu = (uu << 32) | numerator._data[iv];
785 quotient = (quotient << 32) + static_cast<uint32_t>(uu / small_denominator);
786 uu %= small_denominator;
787 }
788
789 numerator = big_integer{};
790 numerator._data[1] = static_cast<uint32_t>(uu >> 32);
791 numerator._data[0] = static_cast<uint32_t>(uu );
792 numerator._used = numerator._data[1] > 0 ? 2 : 1;
793 return quotient;
794 }
795
796 if (max_denominator_element_index > max_numerator_element_index)
797 {
798 return 0;
799 }
800
801 uint32_t cu_den = max_denominator_element_index + 1;
802 int32_t cu_diff = max_numerator_element_index - max_denominator_element_index;
803
804 // Determine whether the result will have cu_diff or cu_diff + 1 digits:
805 int32_t cu_quo = cu_diff;
806 for (int32_t iu = max_numerator_element_index; ; --iu)
807 {
808 if (iu < cu_diff)
809 {
810 ++cu_quo;
811 break;
812 }
813
814 if (denominator._data[iu - cu_diff] != numerator._data[iu])
815 {
816 if (denominator._data[iu - cu_diff] < numerator._data[iu])
817 {
818 ++cu_quo;
819 }
820
821 break;
822 }
823 }
824
825 if (cu_quo == 0)
826 {
827 return 0;
828 }
829
830 // Get the uint to use for the trial divisions. We normalize so the
831 // high bit is set:
832 uint32_t u_den = denominator._data[cu_den - 1];
833 uint32_t u_den_next = denominator._data[cu_den - 2];
834
835 uint32_t cbit_shift_left = count_sequential_high_zeroes(u_den);
836 uint32_t cbit_shift_right = 32 - cbit_shift_left;
837 if (cbit_shift_left > 0)
838 {
839 u_den = (u_den << cbit_shift_left) | (u_den_next >> cbit_shift_right);
840 u_den_next <<= cbit_shift_left;
841
842 if (cu_den > 2)
843 {
844 u_den_next |= denominator._data[cu_den - 3] >> cbit_shift_right;
845 }
846 }
847
848 uint64_t quotient{};
849 for (int32_t iu = cu_quo; --iu >= 0; )
850 {
851 // Get the high (normalized) bits of the numerator:
852 uint32_t u_num_hi = (iu + cu_den <= max_numerator_element_index)
853 ? numerator._data[iu + cu_den]
854 : 0;
855
856 uint64_t uu_num = numerator._data[iu + cu_den - 1];
857 reinterpret_cast<uint32_t*>(&uu_num)[1] = u_num_hi;
858
859 uint32_t u_num_next = numerator._data[iu + cu_den - 2];
860 if (cbit_shift_left > 0)
861 {
862 uu_num = (uu_num << cbit_shift_left) | (u_num_next >> cbit_shift_right);
863 u_num_next <<= cbit_shift_left;
864
865 if (iu + cu_den >= 3)
866 {
867 u_num_next |= numerator._data[iu + cu_den - 3] >> cbit_shift_right;
868 }
869 }
870
871 // Divide to get the quotient digit:
872 uint64_t uu_quo = uu_num / u_den;
873 uint64_t uu_rem = static_cast<uint32_t>(uu_num % u_den);
874
875 if (uu_quo > UINT32_MAX)
876 {
877 uu_rem += u_den * (uu_quo - UINT32_MAX);
878 uu_quo = UINT32_MAX;
879 }
880
881 while (uu_rem <= UINT32_MAX && uu_quo * u_den_next > ((uu_rem << 32) | u_num_next))
882 {
883 --uu_quo;
884 uu_rem += u_den;
885 }
886
887 // Multiply and subtract. Note that uu_quo may be one too large. If
888 // we have a borrow at the end, we'll add the denominator back on and
889 // decrement uu_quo.
890 if (uu_quo > 0)
891 {
892 uint64_t uu_borrow = 0;
893
894 for (uint32_t iu2 = 0; iu2 < cu_den; ++iu2)
895 {
896 uu_borrow += multiply_64_32(uu_quo, denominator._data[iu2]);
897
898 uint32_t const u_sub = static_cast<uint32_t>(uu_borrow);
899 uu_borrow >>= 32;
900 if (numerator._data[iu + iu2] < u_sub)
901 {
902 ++uu_borrow;
903 }
904
905 numerator._data[iu + iu2] -= u_sub;
906 }
907
908 if (u_num_hi < uu_borrow)
909 {
910 // Add, tracking carry:
911 uint32_t u_carry = 0;
912 for (uint32_t iu2 = 0; iu2 < cu_den; ++iu2)
913 {
914 uint64_t const sum =
915 static_cast<uint64_t>(numerator._data[iu + iu2]) +
916 static_cast<uint64_t>(denominator._data[iu2]) +
917 u_carry;
918
919 numerator._data[iu + iu2] = static_cast<uint32_t>(sum);
920 u_carry = sum >> 32;
921 }
922
923 --uu_quo;
924 }
925
926 max_numerator_element_index = iu + cu_den - 1;
927 }
928
929 quotient = (quotient << 32) + static_cast<uint32_t>(uu_quo);
930 }
931
932 // Trim the remainder:
933 for (uint32_t i = max_numerator_element_index + 1; i < numerator._used; ++i)
934 {
935 numerator._data[i] = 0;
936 }
937
938 numerator._used = max_numerator_element_index + 1;
939 while (numerator._used != 0 && numerator._data[numerator._used - 1] == 0)
940 {
941 --numerator._used;
942 }
943
944 return quotient;
945}
946
947} // namespace __crt_strtox
#define __cdecl
Definition: accygwin.h:79
unsigned short int uint16_t
Definition: acefiex.h:54
#define _BEGIN_PRAGMA_OPTIMIZE_ENABLE(flags, bug, reason)
#define _ASSERTE(expr)
Definition: crtdbg.h:114
result_buffer_count char *const _In_ int const _In_ bool const _In_ unsigned const _In_ STRFLT const _In_ bool const _Inout_ __crt_cached_ptd_host &ptd throw()
Definition: cvt.cpp:119
INT32 int32_t
Definition: types.h:71
UINT32 uint32_t
Definition: types.h:75
UINT64 uint64_t
Definition: types.h:77
#define CHAR_BIT
Definition: urlcache.c:62
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
GLdouble n
Definition: glext.h:7729
GLuint index
Definition: glext.h:6031
GLdouble GLdouble u2
Definition: glext.h:8308
GLuint64EXT * result
Definition: glext.h:11304
GLdouble u1
Definition: glext.h:8308
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble * u
Definition: glfuncs.h:240
unsigned char _BitScanReverse(unsigned long *_Index, unsigned long _Mask)
Definition: intrin_arm.h:180
#define UINT32_MAX
Definition: intsafe.h:153
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
static PVOID ptr
Definition: dispmode.c:27
float power
Definition: d3drm.c:3372
int other
Definition: msacm.c:1376
BYTE uint8_t
Definition: msvideo1.c:66
#define mul(aa, bb)
Definition: mvAesAlg.c:25
__forceinline bool __cdecl operator==(big_integer const &lhs, big_integer const &rhs)
__forceinline uint32_t __cdecl bit_scan_reverse(uint32_t const value)
__forceinline bool __cdecl add(big_integer &x, uint32_t const value)
__forceinline uint32_t __cdecl add_multiply_carry(uint32_t &u_add, uint32_t const u_mul_1, uint32_t const u_mul_2, uint32_t const u_carry)
__forceinline bool __cdecl is_zero(big_integer const &value)
__forceinline big_integer __cdecl make_big_integer(uint64_t const value)
uint64_t __cdecl divide(big_integer &numerator, big_integer const &denominator)
__forceinline uint64_t __cdecl multiply_64_32(uint64_t const multiplicand, uint32_t const multiplier)
__forceinline uint32_t __cdecl multiply_core(_Inout_updates_all_(multiplicand_count) uint32_t *const multiplicand, uint32_t const multiplicand_count, uint32_t const multiplier)
__forceinline bool __cdecl operator>=(big_integer const &lhs, big_integer const &rhs)
__forceinline bool __cdecl multiply(big_integer &multiplicand, uint32_t const multiplier)
__forceinline bool __cdecl multiply_by_power_of_ten(big_integer &x, uint32_t const power)
__forceinline uint32_t __cdecl count_sequential_high_zeroes(uint32_t const u)
__forceinline bool __cdecl shift_left(big_integer &x, uint32_t const n)
__forceinline bool __cdecl operator!=(big_integer const &lhs, big_integer const &rhs)
__forceinline uint32_t __cdecl add_carry(uint32_t &u1, uint32_t const u2, uint32_t const u_carry)
__forceinline big_integer __cdecl make_big_integer_power_of_two(uint32_t const power)
__forceinline bool __cdecl operator<(big_integer const &lhs, big_integer const &rhs)
#define _Inout_updates_all_(s)
Definition: no_sal2.h:200
#define uint32_t
Definition: nsiface.idl:61
__asm__(".p2align 4, 0x90\n" ".seh_proc __seh2_global_filter_func\n" "__seh2_global_filter_func:\n" "\tsub %rbp, %rax\n" "\tpush %rbp\n" "\t.seh_pushreg %rbp\n" "\tsub $32, %rsp\n" "\t.seh_stackalloc 32\n" "\t.seh_endprologue\n" "\tsub %rax, %rdx\n" "\tmov %rdx, %rbp\n" "\tjmp *%r8\n" "__seh2_global_filter_func_exit:\n" "\t.p2align 4\n" "\tadd $32, %rsp\n" "\tpop %rbp\n" "\tret\n" "\t.seh_endproc")
static int sum(int x_, int y_)
Definition: ptr2_test.cpp:35
int CDECL memcpy_s(void *dest, size_t numberOfElements, const void *src, size_t count)
Definition: heap.c:800
#define memset(x, y, z)
Definition: compat.h:39
int one
Definition: sehframes.cpp:28
#define _countof(array)
Definition: sndvol32.h:70
__forceinline big_integer & operator=(big_integer const &other)
__forceinline big_integer(big_integer const &other)
ecx edi movl ebx edx edi decl ecx esi eax jecxz decl eax andl eax esi movl eax
Definition: synth_sse3d.h:85
ecx edi movl ebx edx edi decl ecx esi eax jecxz decl eax andl eax esi movl edx
Definition: synth_sse3d.h:87
Definition: pdh_main.c:94
int retval
Definition: wcstombs.cpp:91
#define const
Definition: zconf.h:233