mirror of
https://github.com/ramsey/uuid.git
synced 2026-06-14 15:56:48 +03:00
Remove unnecessary conversions in BigNumberConverter
Using the baseConvert method from BigNumber uses two consecutive convert operations: - convertToBase10 - convertFromBase10 In BigNumberConverters context, we can directly call each specific method to avoid the conversion overhead.
This commit is contained in:
@@ -23,7 +23,7 @@ class BigNumberConverter implements NumberConverterInterface
|
||||
*/
|
||||
public function fromHex($hex)
|
||||
{
|
||||
$number = \Moontoast\Math\BigNumber::baseConvert($hex, 16, 10);
|
||||
$number = \Moontoast\Math\BigNumber::convertToBase10($hex, 16);
|
||||
|
||||
return new \Moontoast\Math\BigNumber($number);
|
||||
}
|
||||
@@ -34,6 +34,6 @@ class BigNumberConverter implements NumberConverterInterface
|
||||
$integer = new \Moontoast\Math\BigNumber($integer);
|
||||
}
|
||||
|
||||
return \Moontoast\Math\BigNumber::baseConvert($integer, 10, 16);
|
||||
return \Moontoast\Math\BigNumber::convertFromBase10($integer, 16);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user