@@ -125,6 +125,66 @@ public bool IsHigh
125
125
}
126
126
}
127
127
128
+
129
+ public Scalar8x32Alt Add ( in Scalar8x32Alt other , out bool overflow )
130
+ {
131
+ ulong t = ( ulong ) b0 + other . b0 ;
132
+ uint r0 = ( uint ) t ; t >>= 32 ;
133
+ t += ( ulong ) b1 + other . b1 ;
134
+ uint r1 = ( uint ) t ; t >>= 32 ;
135
+ t += ( ulong ) b2 + other . b2 ;
136
+ uint r2 = ( uint ) t ; t >>= 32 ;
137
+ t += ( ulong ) b3 + other . b3 ;
138
+ uint r3 = ( uint ) t ; t >>= 32 ;
139
+ t += ( ulong ) b4 + other . b4 ;
140
+ uint r4 = ( uint ) t ; t >>= 32 ;
141
+ t += ( ulong ) b5 + other . b5 ;
142
+ uint r5 = ( uint ) t ; t >>= 32 ;
143
+ t += ( ulong ) b6 + other . b6 ;
144
+ uint r6 = ( uint ) t ; t >>= 32 ;
145
+ t += ( ulong ) b7 + other . b7 ;
146
+ uint r7 = ( uint ) t ; t >>= 32 ;
147
+
148
+ int yes = 0 ;
149
+ int no = 0 ;
150
+ no |= ( r7 < N7 ? 1 : 0 ) ;
151
+ no |= ( r6 < N6 ? 1 : 0 ) ;
152
+ no |= ( r5 < N5 ? 1 : 0 ) ;
153
+ no |= ( r4 < N4 ? 1 : 0 ) ;
154
+ yes |= ( r4 > N4 ? 1 : 0 ) & ~ no ;
155
+ no |= ( r3 < N3 ? 1 : 0 ) & ~ yes ;
156
+ yes |= ( r3 > N3 ? 1 : 0 ) & ~ no ;
157
+ no |= ( r2 < N2 ? 1 : 0 ) & ~ yes ;
158
+ yes |= ( r2 > N2 ? 1 : 0 ) & ~ no ;
159
+ no |= ( r1 < N1 ? 1 : 0 ) & ~ yes ;
160
+ yes |= ( r1 > N1 ? 1 : 0 ) & ~ no ;
161
+ yes |= ( r0 >= N0 ? 1 : 0 ) & ~ no ;
162
+
163
+ uint of = ( uint ) yes + ( uint ) t ;
164
+ overflow = of != 0 ;
165
+
166
+ Debug . Assert ( of == 0 || of == 1 ) ;
167
+
168
+ t = ( ulong ) r0 + ( of * NC0 ) ;
169
+ r0 = ( uint ) t ; t >>= 32 ;
170
+ t += ( ulong ) r1 + ( of * NC1 ) ;
171
+ r1 = ( uint ) t ; t >>= 32 ;
172
+ t += ( ulong ) r2 + ( of * NC2 ) ;
173
+ r2 = ( uint ) t ; t >>= 32 ;
174
+ t += ( ulong ) r3 + ( of * NC3 ) ;
175
+ r3 = ( uint ) t ; t >>= 32 ;
176
+ t += ( ulong ) r4 + ( of * NC4 ) ;
177
+ r4 = ( uint ) t ; t >>= 32 ;
178
+ t += r5 ;
179
+ r5 = ( uint ) t ; t >>= 32 ;
180
+ t += r6 ;
181
+ r6 = ( uint ) t ; t >>= 32 ;
182
+ t += r7 ;
183
+ r7 = ( uint ) t ;
184
+
185
+ return new Scalar8x32Alt ( r0 , r1 , r2 , r3 , r4 , r5 , r6 , r7 ) ;
186
+ }
187
+
128
188
public Scalar8x32Alt Multiply ( in Scalar8x32Alt b )
129
189
{
130
190
uint [ ] l = new uint [ 16 ] ;
0 commit comments