Edit File by line

Deprecated: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in /home/sportsfever/public_html/filemanger/function.php on line 93

Warning: Undefined array key "page_file_edit_line" in /home/sportsfever/public_html/filemanger/edit_text_line.php on line 32
/home/sportsfe.../httpdocs/clone/wp-inclu.../sodium_c.../src/Core32
File: Int32.php
*
[500] Fix | Delete
* @param int $c
[501] Fix | Delete
* @return ParagonIE_Sodium_Core32_Int32
[502] Fix | Delete
* @throws SodiumException
[503] Fix | Delete
* @throws TypeError
[504] Fix | Delete
* @psalm-suppress MixedArrayAccess
[505] Fix | Delete
*/
[506] Fix | Delete
public function rotateRight($c = 0)
[507] Fix | Delete
{
[508] Fix | Delete
ParagonIE_Sodium_Core32_Util::declareScalarType($c, 'int', 1);
[509] Fix | Delete
/** @var int $c */
[510] Fix | Delete
$c = (int) $c;
[511] Fix | Delete
[512] Fix | Delete
$return = new ParagonIE_Sodium_Core32_Int32();
[513] Fix | Delete
$return->unsignedInt = $this->unsignedInt;
[514] Fix | Delete
$c &= 31;
[515] Fix | Delete
/** @var int $c */
[516] Fix | Delete
if ($c === 0) {
[517] Fix | Delete
// NOP, but we want a copy.
[518] Fix | Delete
$return->limbs = $this->limbs;
[519] Fix | Delete
} else {
[520] Fix | Delete
/** @var int $c */
[521] Fix | Delete
[522] Fix | Delete
/** @var int $idx_shift */
[523] Fix | Delete
$idx_shift = ($c >> 4) & 1;
[524] Fix | Delete
[525] Fix | Delete
/** @var int $sub_shift */
[526] Fix | Delete
$sub_shift = $c & 15;
[527] Fix | Delete
[528] Fix | Delete
/** @var array<int, int> $limbs */
[529] Fix | Delete
$limbs =& $return->limbs;
[530] Fix | Delete
[531] Fix | Delete
/** @var array<int, int> $myLimbs */
[532] Fix | Delete
$myLimbs =& $this->limbs;
[533] Fix | Delete
[534] Fix | Delete
for ($i = 1; $i >= 0; --$i) {
[535] Fix | Delete
/** @var int $j */
[536] Fix | Delete
$j = ($i - $idx_shift) & 1;
[537] Fix | Delete
/** @var int $k */
[538] Fix | Delete
$k = ($i - $idx_shift - 1) & 1;
[539] Fix | Delete
$limbs[$i] = (int) (
[540] Fix | Delete
(
[541] Fix | Delete
((int) ($myLimbs[$j]) >> (int) ($sub_shift))
[542] Fix | Delete
|
[543] Fix | Delete
((int) ($myLimbs[$k]) << (16 - (int) ($sub_shift)))
[544] Fix | Delete
) & 0xffff
[545] Fix | Delete
);
[546] Fix | Delete
}
[547] Fix | Delete
}
[548] Fix | Delete
return $return;
[549] Fix | Delete
}
[550] Fix | Delete
[551] Fix | Delete
/**
[552] Fix | Delete
* @param bool $bool
[553] Fix | Delete
* @return self
[554] Fix | Delete
*/
[555] Fix | Delete
public function setUnsignedInt($bool = false)
[556] Fix | Delete
{
[557] Fix | Delete
$this->unsignedInt = !empty($bool);
[558] Fix | Delete
return $this;
[559] Fix | Delete
}
[560] Fix | Delete
[561] Fix | Delete
/**
[562] Fix | Delete
* @param int $c
[563] Fix | Delete
* @return ParagonIE_Sodium_Core32_Int32
[564] Fix | Delete
* @throws SodiumException
[565] Fix | Delete
* @throws TypeError
[566] Fix | Delete
*/
[567] Fix | Delete
public function shiftLeft($c = 0)
[568] Fix | Delete
{
[569] Fix | Delete
ParagonIE_Sodium_Core32_Util::declareScalarType($c, 'int', 1);
[570] Fix | Delete
/** @var int $c */
[571] Fix | Delete
$c = (int) $c;
[572] Fix | Delete
[573] Fix | Delete
$return = new ParagonIE_Sodium_Core32_Int32();
[574] Fix | Delete
$return->unsignedInt = $this->unsignedInt;
[575] Fix | Delete
$c &= 63;
[576] Fix | Delete
/** @var int $c */
[577] Fix | Delete
if ($c === 0) {
[578] Fix | Delete
$return->limbs = $this->limbs;
[579] Fix | Delete
} elseif ($c < 0) {
[580] Fix | Delete
/** @var int $c */
[581] Fix | Delete
return $this->shiftRight(-$c);
[582] Fix | Delete
} else {
[583] Fix | Delete
/** @var int $c */
[584] Fix | Delete
/** @var int $tmp */
[585] Fix | Delete
$tmp = $this->limbs[1] << $c;
[586] Fix | Delete
$return->limbs[1] = (int)($tmp & 0xffff);
[587] Fix | Delete
/** @var int $carry */
[588] Fix | Delete
$carry = $tmp >> 16;
[589] Fix | Delete
[590] Fix | Delete
/** @var int $tmp */
[591] Fix | Delete
$tmp = ($this->limbs[0] << $c) | ($carry & 0xffff);
[592] Fix | Delete
$return->limbs[0] = (int) ($tmp & 0xffff);
[593] Fix | Delete
}
[594] Fix | Delete
return $return;
[595] Fix | Delete
}
[596] Fix | Delete
[597] Fix | Delete
/**
[598] Fix | Delete
* @param int $c
[599] Fix | Delete
* @return ParagonIE_Sodium_Core32_Int32
[600] Fix | Delete
* @throws SodiumException
[601] Fix | Delete
* @throws TypeError
[602] Fix | Delete
* @psalm-suppress MixedAssignment
[603] Fix | Delete
* @psalm-suppress MixedOperand
[604] Fix | Delete
*/
[605] Fix | Delete
public function shiftRight($c = 0)
[606] Fix | Delete
{
[607] Fix | Delete
ParagonIE_Sodium_Core32_Util::declareScalarType($c, 'int', 1);
[608] Fix | Delete
/** @var int $c */
[609] Fix | Delete
$c = (int) $c;
[610] Fix | Delete
[611] Fix | Delete
$return = new ParagonIE_Sodium_Core32_Int32();
[612] Fix | Delete
$return->unsignedInt = $this->unsignedInt;
[613] Fix | Delete
$c &= 63;
[614] Fix | Delete
/** @var int $c */
[615] Fix | Delete
if ($c >= 16) {
[616] Fix | Delete
$return->limbs = array(
[617] Fix | Delete
(int) ($this->overflow & 0xffff),
[618] Fix | Delete
(int) ($this->limbs[0])
[619] Fix | Delete
);
[620] Fix | Delete
$return->overflow = $this->overflow >> 16;
[621] Fix | Delete
return $return->shiftRight($c & 15);
[622] Fix | Delete
}
[623] Fix | Delete
if ($c === 0) {
[624] Fix | Delete
$return->limbs = $this->limbs;
[625] Fix | Delete
} elseif ($c < 0) {
[626] Fix | Delete
/** @var int $c */
[627] Fix | Delete
return $this->shiftLeft(-$c);
[628] Fix | Delete
} else {
[629] Fix | Delete
if (!is_int($c)) {
[630] Fix | Delete
throw new TypeError();
[631] Fix | Delete
}
[632] Fix | Delete
/** @var int $c */
[633] Fix | Delete
// $return->limbs[0] = (int) (($this->limbs[0] >> $c) & 0xffff);
[634] Fix | Delete
$carryLeft = (int) ($this->overflow & ((1 << ($c + 1)) - 1));
[635] Fix | Delete
$return->limbs[0] = (int) ((($this->limbs[0] >> $c) | ($carryLeft << (16 - $c))) & 0xffff);
[636] Fix | Delete
$carryRight = (int) ($this->limbs[0] & ((1 << ($c + 1)) - 1));
[637] Fix | Delete
$return->limbs[1] = (int) ((($this->limbs[1] >> $c) | ($carryRight << (16 - $c))) & 0xffff);
[638] Fix | Delete
$return->overflow >>= $c;
[639] Fix | Delete
}
[640] Fix | Delete
return $return;
[641] Fix | Delete
}
[642] Fix | Delete
[643] Fix | Delete
/**
[644] Fix | Delete
* Subtract a normal integer from an int32 object.
[645] Fix | Delete
*
[646] Fix | Delete
* @param int $int
[647] Fix | Delete
* @return ParagonIE_Sodium_Core32_Int32
[648] Fix | Delete
* @throws SodiumException
[649] Fix | Delete
* @throws TypeError
[650] Fix | Delete
*/
[651] Fix | Delete
public function subInt($int)
[652] Fix | Delete
{
[653] Fix | Delete
ParagonIE_Sodium_Core32_Util::declareScalarType($int, 'int', 1);
[654] Fix | Delete
/** @var int $int */
[655] Fix | Delete
$int = (int) $int;
[656] Fix | Delete
[657] Fix | Delete
$return = new ParagonIE_Sodium_Core32_Int32();
[658] Fix | Delete
$return->unsignedInt = $this->unsignedInt;
[659] Fix | Delete
[660] Fix | Delete
/** @var int $tmp */
[661] Fix | Delete
$tmp = $this->limbs[1] - ($int & 0xffff);
[662] Fix | Delete
/** @var int $carry */
[663] Fix | Delete
$carry = $tmp >> 16;
[664] Fix | Delete
$return->limbs[1] = (int) ($tmp & 0xffff);
[665] Fix | Delete
[666] Fix | Delete
/** @var int $tmp */
[667] Fix | Delete
$tmp = $this->limbs[0] - (($int >> 16) & 0xffff) + $carry;
[668] Fix | Delete
$return->limbs[0] = (int) ($tmp & 0xffff);
[669] Fix | Delete
return $return;
[670] Fix | Delete
}
[671] Fix | Delete
[672] Fix | Delete
/**
[673] Fix | Delete
* Subtract two int32 objects from each other
[674] Fix | Delete
*
[675] Fix | Delete
* @param ParagonIE_Sodium_Core32_Int32 $b
[676] Fix | Delete
* @return ParagonIE_Sodium_Core32_Int32
[677] Fix | Delete
*/
[678] Fix | Delete
public function subInt32(ParagonIE_Sodium_Core32_Int32 $b)
[679] Fix | Delete
{
[680] Fix | Delete
$return = new ParagonIE_Sodium_Core32_Int32();
[681] Fix | Delete
$return->unsignedInt = $this->unsignedInt;
[682] Fix | Delete
[683] Fix | Delete
/** @var int $tmp */
[684] Fix | Delete
$tmp = $this->limbs[1] - ($b->limbs[1] & 0xffff);
[685] Fix | Delete
/** @var int $carry */
[686] Fix | Delete
$carry = $tmp >> 16;
[687] Fix | Delete
$return->limbs[1] = (int) ($tmp & 0xffff);
[688] Fix | Delete
[689] Fix | Delete
/** @var int $tmp */
[690] Fix | Delete
$tmp = $this->limbs[0] - ($b->limbs[0] & 0xffff) + $carry;
[691] Fix | Delete
$return->limbs[0] = (int) ($tmp & 0xffff);
[692] Fix | Delete
return $return;
[693] Fix | Delete
}
[694] Fix | Delete
[695] Fix | Delete
/**
[696] Fix | Delete
* XOR this 32-bit integer with another.
[697] Fix | Delete
*
[698] Fix | Delete
* @param ParagonIE_Sodium_Core32_Int32 $b
[699] Fix | Delete
* @return ParagonIE_Sodium_Core32_Int32
[700] Fix | Delete
*/
[701] Fix | Delete
public function xorInt32(ParagonIE_Sodium_Core32_Int32 $b)
[702] Fix | Delete
{
[703] Fix | Delete
$return = new ParagonIE_Sodium_Core32_Int32();
[704] Fix | Delete
$return->unsignedInt = $this->unsignedInt;
[705] Fix | Delete
$return->limbs = array(
[706] Fix | Delete
(int) ($this->limbs[0] ^ $b->limbs[0]),
[707] Fix | Delete
(int) ($this->limbs[1] ^ $b->limbs[1])
[708] Fix | Delete
);
[709] Fix | Delete
return $return;
[710] Fix | Delete
}
[711] Fix | Delete
[712] Fix | Delete
/**
[713] Fix | Delete
* @param int $signed
[714] Fix | Delete
* @return self
[715] Fix | Delete
* @throws SodiumException
[716] Fix | Delete
* @throws TypeError
[717] Fix | Delete
*/
[718] Fix | Delete
public static function fromInt($signed)
[719] Fix | Delete
{
[720] Fix | Delete
ParagonIE_Sodium_Core32_Util::declareScalarType($signed, 'int', 1);;
[721] Fix | Delete
/** @var int $signed */
[722] Fix | Delete
$signed = (int) $signed;
[723] Fix | Delete
[724] Fix | Delete
return new ParagonIE_Sodium_Core32_Int32(
[725] Fix | Delete
array(
[726] Fix | Delete
(int) (($signed >> 16) & 0xffff),
[727] Fix | Delete
(int) ($signed & 0xffff)
[728] Fix | Delete
)
[729] Fix | Delete
);
[730] Fix | Delete
}
[731] Fix | Delete
[732] Fix | Delete
/**
[733] Fix | Delete
* @param string $string
[734] Fix | Delete
* @return self
[735] Fix | Delete
* @throws SodiumException
[736] Fix | Delete
* @throws TypeError
[737] Fix | Delete
*/
[738] Fix | Delete
public static function fromString($string)
[739] Fix | Delete
{
[740] Fix | Delete
ParagonIE_Sodium_Core32_Util::declareScalarType($string, 'string', 1);
[741] Fix | Delete
$string = (string) $string;
[742] Fix | Delete
if (ParagonIE_Sodium_Core32_Util::strlen($string) !== 4) {
[743] Fix | Delete
throw new RangeException(
[744] Fix | Delete
'String must be 4 bytes; ' . ParagonIE_Sodium_Core32_Util::strlen($string) . ' given.'
[745] Fix | Delete
);
[746] Fix | Delete
}
[747] Fix | Delete
$return = new ParagonIE_Sodium_Core32_Int32();
[748] Fix | Delete
[749] Fix | Delete
$return->limbs[0] = (int) ((ParagonIE_Sodium_Core32_Util::chrToInt($string[0]) & 0xff) << 8);
[750] Fix | Delete
$return->limbs[0] |= (ParagonIE_Sodium_Core32_Util::chrToInt($string[1]) & 0xff);
[751] Fix | Delete
$return->limbs[1] = (int) ((ParagonIE_Sodium_Core32_Util::chrToInt($string[2]) & 0xff) << 8);
[752] Fix | Delete
$return->limbs[1] |= (ParagonIE_Sodium_Core32_Util::chrToInt($string[3]) & 0xff);
[753] Fix | Delete
return $return;
[754] Fix | Delete
}
[755] Fix | Delete
[756] Fix | Delete
/**
[757] Fix | Delete
* @param string $string
[758] Fix | Delete
* @return self
[759] Fix | Delete
* @throws SodiumException
[760] Fix | Delete
* @throws TypeError
[761] Fix | Delete
*/
[762] Fix | Delete
public static function fromReverseString($string)
[763] Fix | Delete
{
[764] Fix | Delete
ParagonIE_Sodium_Core32_Util::declareScalarType($string, 'string', 1);
[765] Fix | Delete
$string = (string) $string;
[766] Fix | Delete
if (ParagonIE_Sodium_Core32_Util::strlen($string) !== 4) {
[767] Fix | Delete
throw new RangeException(
[768] Fix | Delete
'String must be 4 bytes; ' . ParagonIE_Sodium_Core32_Util::strlen($string) . ' given.'
[769] Fix | Delete
);
[770] Fix | Delete
}
[771] Fix | Delete
$return = new ParagonIE_Sodium_Core32_Int32();
[772] Fix | Delete
[773] Fix | Delete
$return->limbs[0] = (int) ((ParagonIE_Sodium_Core32_Util::chrToInt($string[3]) & 0xff) << 8);
[774] Fix | Delete
$return->limbs[0] |= (ParagonIE_Sodium_Core32_Util::chrToInt($string[2]) & 0xff);
[775] Fix | Delete
$return->limbs[1] = (int) ((ParagonIE_Sodium_Core32_Util::chrToInt($string[1]) & 0xff) << 8);
[776] Fix | Delete
$return->limbs[1] |= (ParagonIE_Sodium_Core32_Util::chrToInt($string[0]) & 0xff);
[777] Fix | Delete
return $return;
[778] Fix | Delete
}
[779] Fix | Delete
[780] Fix | Delete
/**
[781] Fix | Delete
* @return array<int, int>
[782] Fix | Delete
*/
[783] Fix | Delete
public function toArray()
[784] Fix | Delete
{
[785] Fix | Delete
return array((int) ($this->limbs[0] << 16 | $this->limbs[1]));
[786] Fix | Delete
}
[787] Fix | Delete
[788] Fix | Delete
/**
[789] Fix | Delete
* @return string
[790] Fix | Delete
* @throws TypeError
[791] Fix | Delete
*/
[792] Fix | Delete
public function toString()
[793] Fix | Delete
{
[794] Fix | Delete
return
[795] Fix | Delete
ParagonIE_Sodium_Core32_Util::intToChr(($this->limbs[0] >> 8) & 0xff) .
[796] Fix | Delete
ParagonIE_Sodium_Core32_Util::intToChr($this->limbs[0] & 0xff) .
[797] Fix | Delete
ParagonIE_Sodium_Core32_Util::intToChr(($this->limbs[1] >> 8) & 0xff) .
[798] Fix | Delete
ParagonIE_Sodium_Core32_Util::intToChr($this->limbs[1] & 0xff);
[799] Fix | Delete
}
[800] Fix | Delete
[801] Fix | Delete
/**
[802] Fix | Delete
* @return int
[803] Fix | Delete
*/
[804] Fix | Delete
public function toInt()
[805] Fix | Delete
{
[806] Fix | Delete
return (int) (
[807] Fix | Delete
(($this->limbs[0] & 0xffff) << 16)
[808] Fix | Delete
|
[809] Fix | Delete
($this->limbs[1] & 0xffff)
[810] Fix | Delete
);
[811] Fix | Delete
}
[812] Fix | Delete
[813] Fix | Delete
/**
[814] Fix | Delete
* @return ParagonIE_Sodium_Core32_Int32
[815] Fix | Delete
*/
[816] Fix | Delete
public function toInt32()
[817] Fix | Delete
{
[818] Fix | Delete
$return = new ParagonIE_Sodium_Core32_Int32();
[819] Fix | Delete
$return->limbs[0] = (int) ($this->limbs[0] & 0xffff);
[820] Fix | Delete
$return->limbs[1] = (int) ($this->limbs[1] & 0xffff);
[821] Fix | Delete
$return->unsignedInt = $this->unsignedInt;
[822] Fix | Delete
$return->overflow = (int) ($this->overflow & 0x7fffffff);
[823] Fix | Delete
return $return;
[824] Fix | Delete
}
[825] Fix | Delete
[826] Fix | Delete
/**
[827] Fix | Delete
* @return ParagonIE_Sodium_Core32_Int64
[828] Fix | Delete
*/
[829] Fix | Delete
public function toInt64()
[830] Fix | Delete
{
[831] Fix | Delete
$return = new ParagonIE_Sodium_Core32_Int64();
[832] Fix | Delete
$return->unsignedInt = $this->unsignedInt;
[833] Fix | Delete
if ($this->unsignedInt) {
[834] Fix | Delete
$return->limbs[0] += (($this->overflow >> 16) & 0xffff);
[835] Fix | Delete
$return->limbs[1] += (($this->overflow) & 0xffff);
[836] Fix | Delete
} else {
[837] Fix | Delete
$neg = -(($this->limbs[0] >> 15) & 1);
[838] Fix | Delete
$return->limbs[0] = (int)($neg & 0xffff);
[839] Fix | Delete
$return->limbs[1] = (int)($neg & 0xffff);
[840] Fix | Delete
}
[841] Fix | Delete
$return->limbs[2] = (int) ($this->limbs[0] & 0xffff);
[842] Fix | Delete
$return->limbs[3] = (int) ($this->limbs[1] & 0xffff);
[843] Fix | Delete
return $return;
[844] Fix | Delete
}
[845] Fix | Delete
[846] Fix | Delete
/**
[847] Fix | Delete
* @return string
[848] Fix | Delete
* @throws TypeError
[849] Fix | Delete
*/
[850] Fix | Delete
public function toReverseString()
[851] Fix | Delete
{
[852] Fix | Delete
return ParagonIE_Sodium_Core32_Util::intToChr($this->limbs[1] & 0xff) .
[853] Fix | Delete
ParagonIE_Sodium_Core32_Util::intToChr(($this->limbs[1] >> 8) & 0xff) .
[854] Fix | Delete
ParagonIE_Sodium_Core32_Util::intToChr($this->limbs[0] & 0xff) .
[855] Fix | Delete
ParagonIE_Sodium_Core32_Util::intToChr(($this->limbs[0] >> 8) & 0xff);
[856] Fix | Delete
}
[857] Fix | Delete
[858] Fix | Delete
/**
[859] Fix | Delete
* @return string
[860] Fix | Delete
*/
[861] Fix | Delete
public function __toString()
[862] Fix | Delete
{
[863] Fix | Delete
try {
[864] Fix | Delete
return $this->toString();
[865] Fix | Delete
} catch (TypeError $ex) {
[866] Fix | Delete
// PHP engine can't handle exceptions from __toString()
[867] Fix | Delete
return '';
[868] Fix | Delete
}
[869] Fix | Delete
}
[870] Fix | Delete
}
[871] Fix | Delete
[872] Fix | Delete
12
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function