3
Copyright 2002, 2004 Free Software Foundation, Inc.
5
This file is part of the GNU MP Library.
7
The GNU MP Library is free software; you can redistribute it and/or modify
8
it under the terms of the GNU Lesser General Public License as published by
9
the Free Software Foundation; either version 2.1 of the License, or (at your
10
option) any later version.
12
The GNU MP Library is distributed in the hope that it will be useful, but
13
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
14
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
15
License for more details.
17
You should have received a copy of the GNU Lesser General Public License
18
along with the GNU MP Library; see the file COPYING.LIB. If not, write to
19
the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
20
MA 02111-1307, USA. */
47
{ "0x12345678", 4,1, 1,1, 0, { 0x12, 0x34, 0x56, 0x78 } },
48
{ "0x12345678", 1,1, 4,1, 0, { 0x12, 0x34, 0x56, 0x78 } },
49
{ "0x12345678", 1,-1, 4,1, 0, { 0x12, 0x34, 0x56, 0x78 } },
51
{ "0x12345678", 4,-1, 1,-1, 0, { 0x78, 0x56, 0x34, 0x12 } },
52
{ "0x12345678", 1,1, 4,-1, 0, { 0x78, 0x56, 0x34, 0x12 } },
53
{ "0x12345678", 1,-1, 4,-1, 0, { 0x78, 0x56, 0x34, 0x12 } },
55
{ "0", 5,1, 1,1, 7, { 0xFE, 0xFE, 0xFE, 0xFE, 0xFE } },
56
{ "0", 5,-1, 1,1, 7, { 0xFE, 0xFE, 0xFE, 0xFE, 0xFE } },
57
{ "0x15", 5,1, 1,1, 7, { 0xFF, 0xFE, 0xFF, 0xFE, 0xFF } },
59
{ "0", 3,1, 2,1, 1, { 0x80,0x00, 0x80,0x00, 0x80,0x00 } },
60
{ "0", 3,1, 2,-1, 1, { 0x00,0x80, 0x00,0x80, 0x00,0x80 } },
61
{ "0", 3,1, 2,1, 15, { 0xFF,0xFE, 0xFF,0xFE, 0xFF,0xFE } },
63
{ "0x2A", 3,1, 2,1, 14, { 0xFF,0xFE, 0xFF,0xFE, 0xFF,0xFE } },
64
{ "0x06", 3,1, 2,1, 14, { 0xFF,0xFC, 0xFF,0xFD, 0xFF,0xFE } },
65
{ "0x24", 3,-1, 2,1, 14, { 0xFF,0xFC, 0xFF,0xFD, 0xFF,0xFE } },
67
{ "0x123456789ABC", 3,1, 2,1, 0, { 0x12,0x34, 0x56,0x78, 0x9A,0xBC } },
68
{ "0x123456789ABC", 3,-1, 2,1, 0, { 0x9A,0xBC, 0x56,0x78, 0x12,0x34 } },
69
{ "0x123456789ABC", 3,1, 2,-1, 0, { 0x34,0x12, 0x78,0x56, 0xBC,0x9A } },
70
{ "0x123456789ABC", 3,-1, 2,-1, 0, { 0xBC,0x9A, 0x78,0x56, 0x34,0x12 } },
72
{ "0x112233445566778899AABBCC", 3,1, 4,1, 0,
73
{ 0x11,0x22,0x33,0x44, 0x55,0x66,0x77,0x88, 0x99,0xAA,0xBB,0xCC } },
74
{ "0x112233445566778899AABBCC", 3,-1, 4,1, 0,
75
{ 0x99,0xAA,0xBB,0xCC, 0x55,0x66,0x77,0x88, 0x11,0x22,0x33,0x44 } },
76
{ "0x112233445566778899AABBCC", 3,1, 4,-1, 0,
77
{ 0x44,0x33,0x22,0x11, 0x88,0x77,0x66,0x55, 0xCC,0xBB,0xAA,0x99 } },
78
{ "0x112233445566778899AABBCC", 3,-1, 4,-1, 0,
79
{ 0xCC,0xBB,0xAA,0x99, 0x88,0x77,0x66,0x55, 0x44,0x33,0x22,0x11 } },
81
{ "0x100120023003400450056006700780089009A00AB00BC00C", 3,1, 8,1, 0,
82
{ 0x10,0x01,0x20,0x02,0x30,0x03,0x40,0x04,
83
0x50,0x05,0x60,0x06,0x70,0x07,0x80,0x08,
84
0x90,0x09,0xA0,0x0A,0xB0,0x0B,0xC0,0x0C } },
85
{ "0x100120023003400450056006700780089009A00AB00BC00C", 3,-1, 8,1, 0,
86
{ 0x90,0x09,0xA0,0x0A,0xB0,0x0B,0xC0,0x0C,
87
0x50,0x05,0x60,0x06,0x70,0x07,0x80,0x08,
88
0x10,0x01,0x20,0x02,0x30,0x03,0x40,0x04 } },
89
{ "0x100120023003400450056006700780089009A00AB00BC00C", 3,1, 8,-1, 0,
90
{ 0x04,0x40,0x03,0x30,0x02,0x20,0x01,0x10,
91
0x08,0x80,0x07,0x70,0x06,0x60,0x05,0x50,
92
0x0C,0xC0,0x0B,0xB0,0x0A,0xA0,0x09,0x90 } },
93
{ "0x100120023003400450056006700780089009A00AB00BC00C", 3,-1, 8,-1, 0,
94
{ 0x0C,0xC0,0x0B,0xB0,0x0A,0xA0,0x09,0x90,
95
0x08,0x80,0x07,0x70,0x06,0x60,0x05,0x50,
96
0x04,0x40,0x03,0x30,0x02,0x20,0x01,0x10 } },
98
{ "0x155555555555555555555555", 3,1, 4,1, 1,
99
{ 0xD5,0x55,0x55,0x55, 0xAA,0xAA,0xAA,0xAA, 0xD5,0x55,0x55,0x55 } },
100
{ "0x155555555555555555555555", 3,-1, 4,1, 1,
101
{ 0xD5,0x55,0x55,0x55, 0xAA,0xAA,0xAA,0xAA, 0xD5,0x55,0x55,0x55 } },
102
{ "0x155555555555555555555555", 3,1, 4,-1, 1,
103
{ 0x55,0x55,0x55,0xD5, 0xAA,0xAA,0xAA,0xAA, 0x55,0x55,0x55,0xD5 } },
104
{ "0x155555555555555555555555", 3,-1, 4,-1, 1,
105
{ 0x55,0x55,0x55,0xD5, 0xAA,0xAA,0xAA,0xAA, 0x55,0x55,0x55,0xD5 } },
108
char buf[sizeof(data[0].src) + sizeof (mp_limb_t)];
117
for (i = 0; i < numberof (data); i++)
119
for (align = 0; align < sizeof (mp_limb_t); align++)
121
mpz_set_str_or_abort (want, data[i].want, 0);
123
memcpy (src, data[i].src, data[i].count * data[i].size);
125
mpz_set_ui (got, 0L);
126
mpz_import (got, data[i].count, data[i].order,
127
data[i].size, data[i].endian, data[i].nail, src);
129
MPZ_CHECK_FORMAT (got);
130
if (mpz_cmp (got, want) != 0)
132
printf ("wrong at data[%d]\n", i);
133
printf (" count=%u order=%d size=%u endian=%d nail=%u align=%u\n",
134
data[i].count, data[i].order,
135
data[i].size, data[i].endian, data[i].nail,
137
mpz_trace (" got ", got);
138
mpz_trace (" want", want);