File tree Expand file tree Collapse file tree 1 file changed +5
-6
lines changed
lib/node_modules/@stdlib/array/fixed-endian-factory/lib Expand file tree Collapse file tree 1 file changed +5
-6
lines changed Original file line number Diff line number Diff line change @@ -44,6 +44,7 @@ var contains = require( '@stdlib/array/base/assert/contains' ).factory;
4444var bytesPerElement = require ( '@stdlib/ndarray/base/bytes-per-element' ) ;
4545var capitalize = require ( '@stdlib/string/base/capitalize' ) ;
4646var format = require ( '@stdlib/string/format' ) ;
47+ var floor = require ( '@stdlib/math/base/special/floor' ) ;
4748var fromIterator = require ( './from_iterator.js' ) ;
4849var fromIteratorMap = require ( './from_iterator_map.js' ) ;
4950
@@ -699,14 +700,12 @@ function factory( dtype ) { // eslint-disable-line max-lines-per-function, stdli
699700 }
700701 buf = this . _buffer ;
701702 len = this . _length ;
702-
703- // Compute floor of len / 2
704- N = ( ( len + 1 ) / 2 * 2 ) - ( len % 2 ) ;
703+ N = floor ( len / 2 ) ;
705704 for ( i = 0 ; i < N ; i ++ ) {
706705 j = len - i - 1 ;
707- tmp = buf [ i ] ;
708- buf [ i ] = buf [ j ] ;
709- buf [ j ] = tmp ;
706+ tmp = buf [ GETTER ] ( i * BYTES_PER_ELEMENT , this . _isLE ) ;
707+ buf [ SETTER ] ( i * BYTES_PER_ELEMENT , buf [ GETTER ] ( j * BYTES_PER_ELEMENT , this . _isLE ) , this . _isLE ) ;
708+ buf [ SETTER ] ( j * BYTES_PER_ELEMENT , tmp , this . _isLE ) ;
710709 }
711710 return this ;
712711 } ) ;
You can’t perform that action at this time.
0 commit comments