OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [libgcc/] [config/] [libbid/] [bid128_2_str_macros.h] - Blame information for rev 734

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 734 jeremybenn
/* Copyright (C) 2007, 2009  Free Software Foundation, Inc.
2
 
3
This file is part of GCC.
4
 
5
GCC is free software; you can redistribute it and/or modify it under
6
the terms of the GNU General Public License as published by the Free
7
Software Foundation; either version 3, or (at your option) any later
8
version.
9
 
10
GCC is distributed in the hope that it will be useful, but WITHOUT ANY
11
WARRANTY; without even the implied warranty of MERCHANTABILITY or
12
FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
13
for more details.
14
 
15
Under Section 7 of GPL version 3, you are granted additional
16
permissions described in the GCC Runtime Library Exception, version
17
3.1, as published by the Free Software Foundation.
18
 
19
You should have received a copy of the GNU General Public License and
20
a copy of the GCC Runtime Library Exception along with this program;
21
see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
22
<http://www.gnu.org/licenses/>.  */
23
 
24
#define __L0_Normalize_10to18( X_hi, X_lo )            \
25
{                                                      \
26
UINT64 L0_tmp;                                         \
27
L0_tmp = (X_lo) + Twoto60_m_10to18;                    \
28
if (L0_tmp & Twoto60)                                  \
29
 {(X_hi)=(X_hi)+1;(X_lo)=((L0_tmp<<4)>>4);}            \
30
}
31
 
32
 
33
#define __L0_Normalize_10to9( X_hi, X_lo )             \
34
{                                                      \
35
UINT32 L0_tmp;                                         \
36
L0_tmp = (X_lo) + Twoto30_m_10to9;                     \
37
if (L0_tmp & 0x40000000)                               \
38
 {(X_hi)=(X_hi)+1;(X_lo)=((L0_tmp<<2)>>2);}            \
39
}
40
 
41
 
42
#define __L0_Split_MiDi_2( X, ptr )                    \
43
{                                                      \
44
UINT32 L0_head, L0_tail, L0_tmp;                       \
45
 L0_head = (X) >> 10;                                  \
46
 L0_tail = ((X)&(0x03FF))+(L0_head<<5)-(L0_head<<3);   \
47
 L0_tmp  = (L0_tail)>>10; L0_head += L0_tmp;           \
48
 L0_tail = (L0_tail&(0x03FF))+(L0_tmp<<5)-(L0_tmp<<3); \
49
 if (L0_tail > 999){L0_tail -= 1000; L0_head += 1;}    \
50
 *((ptr)++) = L0_head; *((ptr)++) = L0_tail;           \
51
}
52
 
53
 
54
#define __L0_Split_MiDi_3( X, ptr )                    \
55
{                                                      \
56
UINT32 L0_X, L0_head, L0_mid, L0_tail, L0_tmp;         \
57
 L0_X    = (UINT32)((X));                              \
58
 L0_head = ((L0_X>>17)*34359)>>18;                     \
59
 L0_X   -= L0_head*1000000;                            \
60
 if (L0_X >= 1000000){L0_X -= 1000000;L0_head+=1;}     \
61
 L0_mid  = L0_X >> 10;                                 \
62
 L0_tail = (L0_X & (0x03FF))+(L0_mid<<5)-(L0_mid<<3);  \
63
 L0_tmp  = (L0_tail)>>10; L0_mid += L0_tmp;            \
64
 L0_tail = (L0_tail&(0x3FF))+(L0_tmp<<5)-(L0_tmp<<3);  \
65
 if (L0_tail>999){L0_tail-=1000;L0_mid+=1;}            \
66
 *((ptr)++)=L0_head;*((ptr)++)=L0_mid;                 \
67
 *((ptr)++)=L0_tail;                                   \
68
}
69
 
70
#define __L1_Split_MiDi_6( X, ptr )                    \
71
{                                                      \
72
UINT32 L1_X_hi, L1_X_lo;                               \
73
UINT64 L1_Xhi_64, L1_Xlo_64;                           \
74
L1_Xhi_64 = ( ((X)>>28)*Inv_Tento9 ) >> 33;            \
75
L1_Xlo_64 = (X) - L1_Xhi_64*(UINT64)Tento9;            \
76
if (L1_Xlo_64 >= (UINT64)Tento9)                       \
77
 {L1_Xlo_64-=(UINT64)Tento9;L1_Xhi_64+=1;}             \
78
L1_X_hi=(UINT32)L1_Xhi_64; L1_X_lo=(UINT32)L1_Xlo_64;  \
79
__L0_Split_MiDi_3(L1_X_hi,(ptr));                      \
80
__L0_Split_MiDi_3(L1_X_lo,(ptr));                      \
81
}
82
 
83
#define __L1_Split_MiDi_6_Lead( X, ptr )               \
84
{                                                      \
85
UINT32 L1_X_hi, L1_X_lo;                               \
86
UINT64 L1_Xhi_64, L1_Xlo_64;                           \
87
if ((X)>=(UINT64)Tento9){                              \
88
  L1_Xhi_64 = ( ((X)>>28)*Inv_Tento9 ) >> 33;          \
89
  L1_Xlo_64 = (X) - L1_Xhi_64*(UINT64)Tento9;          \
90
  if (L1_Xlo_64 >= (UINT64)Tento9)                     \
91
   {L1_Xlo_64-=(UINT64)Tento9;L1_Xhi_64+=1;}           \
92
  L1_X_hi=(UINT32)L1_Xhi_64;                           \
93
  L1_X_lo=(UINT32)L1_Xlo_64;                           \
94
  if (L1_X_hi>=Tento6){                                \
95
     __L0_Split_MiDi_3(L1_X_hi,(ptr));                 \
96
     __L0_Split_MiDi_3(L1_X_lo,(ptr));                 \
97
  }                                                    \
98
  else if (L1_X_hi>=Tento3){                           \
99
     __L0_Split_MiDi_2(L1_X_hi,(ptr));                 \
100
     __L0_Split_MiDi_3(L1_X_lo,(ptr));                 \
101
  }                                                    \
102
  else {                                               \
103
       *((ptr)++) = L1_X_hi;                           \
104
       __L0_Split_MiDi_3(L1_X_lo,(ptr));               \
105
  }                                                    \
106
}                                                      \
107
else {                                                 \
108
  L1_X_lo = (UINT32)(X);                               \
109
  if (L1_X_lo>=Tento6){                                \
110
     __L0_Split_MiDi_3(L1_X_lo,(ptr));                 \
111
  }                                                    \
112
  else if (L1_X_lo>=Tento3){                           \
113
     __L0_Split_MiDi_2(L1_X_lo,(ptr));                 \
114
  }                                                    \
115
  else {                                               \
116
       *((ptr)++) = L1_X_lo;                           \
117
  }                                                    \
118
}                                                      \
119
}
120
 
121
 
122
#define __L0_MiDi2Str( X, c_ptr )              \
123
{                                              \
124
char *L0_src;                                  \
125
 L0_src = midi_tbl[(X)];                       \
126
 *((c_ptr)++) = *(L0_src++);                   \
127
 *((c_ptr)++) = *(L0_src++);                   \
128
 *((c_ptr)++) = *(L0_src);                     \
129
}
130
 
131
#define __L0_MiDi2Str_Lead( X, c_ptr )         \
132
{                                              \
133
char *L0_src;                                  \
134
 L0_src = midi_tbl[(X)];                       \
135
 if ((X)>=100){                                \
136
 *((c_ptr)++) = *(L0_src++);                   \
137
 *((c_ptr)++) = *(L0_src++);                   \
138
 *((c_ptr)++) = *(L0_src);                     \
139
 }                                             \
140
 else if ((X)>=10){                            \
141
 L0_src++;                                     \
142
 *((c_ptr)++) = *(L0_src++);                   \
143
 *((c_ptr)++) = *(L0_src);                     \
144
 }                                             \
145
 else {                                        \
146
 L0_src++;L0_src++;                            \
147
 *((c_ptr)++) = *(L0_src);                     \
148
}                                              \
149
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.