File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -212,6 +212,8 @@ struct BigInt(uint size64)
212212 return false ;
213213 this .sign = sign;
214214 this .length = cast (uint ) (data.length / size_t .sizeof);
215+ auto tail = data[0 .. data.length % size_t .sizeof];
216+ data = data[data.length % size_t .sizeof .. $];
215217 foreach_reverse (ref c; this .coefficients)
216218 {
217219 size_t value;
@@ -223,11 +225,12 @@ struct BigInt(uint size64)
223225 }
224226 c = value;
225227 }
226- if (data.length)
228+ assert (data.length == 0 );
229+ if (tail.length)
227230 {
228231 this .length++ ;
229232 size_t value;
230- foreach (b; data )
233+ foreach (b; tail )
231234 {
232235 value <<= 8 ;
233236 value |= b;
Original file line number Diff line number Diff line change @@ -231,6 +231,11 @@ version(mir_bignum_test)
231231 test(" 36893488147419103229.0" );
232232 test(" 36893488147419103229" );
233233
234+ test(" 18446744073709551615." );
235+ test(" -18446744073709551615." );
236+ test(" 18446744073709551616." );
237+ test(" -18446744073709551616." );
238+
234239// Related DMD Issues:
235240// https://issues.dlang.org/show_bug.cgi?id=20951
236241// https://issues.dlang.org/show_bug.cgi?id=20952
You can’t perform that action at this time.
0 commit comments