File tree Expand file tree Collapse file tree 3 files changed +13
-2
lines changed
Expand file tree Collapse file tree 3 files changed +13
-2
lines changed Original file line number Diff line number Diff line change 1616 fetch-depth : 1
1717
1818 - name : Restore node_modules cache
19- uses : actions/cache@v1
19+ uses : actions/cache@v4
2020 with :
2121 path : ~/.npm
2222 key : ${{ runner.os }}-node-${{ hashFiles('**/package.json') }}
3737 fetch-depth : 1
3838
3939 - name : Restore node_modules cache
40- uses : actions/cache@v1
40+ uses : actions/cache@v4
4141 with :
4242 path : ~/.npm
4343 key : ${{ runner.os }}-node-${{ hashFiles('**/package.json') }}
Original file line number Diff line number Diff line change 20082008 this . words [ i ] = carry ;
20092009 this . length ++ ;
20102010 }
2011+ this . length = num === 0 ? 1 : this . length ;
20112012
20122013 return isNegNum ? this . ineg ( ) : this ;
20132014 } ;
Original file line number Diff line number Diff line change @@ -305,6 +305,16 @@ describe('BN.js/Arithmetic', function () {
305305 assert . equal ( b . clone ( ) . imuln ( - 42 ) . toString ( 16 ) , b . clone ( ) . neg ( ) . muln ( 42 ) . toString ( 16 ) ) ;
306306 assert . equal ( b . clone ( ) . muln ( - 42 ) . toString ( 16 ) , b . clone ( ) . neg ( ) . muln ( 42 ) . toString ( 16 ) ) ;
307307 } ) ;
308+
309+ it ( 'should strip length on zero multiplication' , function ( ) {
310+ var a = new BN ( 42 ) ;
311+ assert . equal ( a . clone ( ) . imuln ( 0 ) . isZero ( ) , true ) ;
312+ assert . equal ( a . clone ( ) . muln ( 0 ) . isZero ( ) , true ) ;
313+
314+ var b = new BN ( '1222222225255589' ) ;
315+ assert . equal ( b . clone ( ) . imuln ( 0 ) . isZero ( ) , true ) ;
316+ assert . equal ( b . clone ( ) . muln ( 0 ) . isZero ( ) , true ) ;
317+ } ) ;
308318 } ) ;
309319
310320 describe ( '.pow()' , function ( ) {
You can’t perform that action at this time.
0 commit comments