PluginProbe
Media Cloud Sync / 1.4.2
Media Cloud Sync v1.4.2
1.4.2 1.4.1 1.4.0 1.3.12 1.3.11 1.3.10 trunk 1.0.0 1.0.1 1.0.2 1.0.3 1.1.0 1.1.1 1.2.0 1.2.10 1.2.11 1.2.12 1.2.13 1.2.2 1.2.3 1.2.4 1.2.5 1.2.6 1.2.7 1.2.8 All 36 releases
media-cloud-sync / includes / sdk / google / ramsey / uuid / src / BinaryUtils.php

BinaryUtils.php in Media Cloud Sync 1.4.2, at includes/sdk/google/ramsey/uuid/src/BinaryUtils.php

52 lines 1.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 /**
4 * This file is part of the ramsey/uuid library
5 *
6 * For the full copyright and license information, please view the LICENSE
7 * file that was distributed with this source code.
8 *
9 * @copyright Copyright (c) Ben Ramsey <[email protected]>
10 * @license http://opensource.org/licenses/MIT MIT
11 */
12 declare (strict_types=1);
13 namespace Dudlewebs\WPMCS\GCP\Ramsey\Uuid;
14
15 /**
16 * Provides binary math utilities
17 */
18 class BinaryUtils
19 {
20 /**
21 * Applies the variant field to the 16-bit clock sequence
22 *
23 * @link https://www.rfc-editor.org/rfc/rfc9562#section-4.1 RFC 9562, 4.1. Variant Field
24 *
25 * @param int $clockSeq The 16-bit clock sequence value before the variant is applied
26 *
27 * @return int The 16-bit clock sequence multiplexed with the UUID variant
28 *
29 * @pure
30 */
31 public static function applyVariant(int $clockSeq) : int
32 {
33 return $clockSeq & 0x3fff | 0x8000;
34 }
35 /**
36 * Applies the version field to the 16-bit `time_hi_and_version` field
37 *
38 * @link https://www.rfc-editor.org/rfc/rfc9562#section-4.2 RFC 9562, 4.2. Version Field
39 *
40 * @param int $timeHi The value of the 16-bit `time_hi_and_version` field before the version is applied
41 * @param int $version The version to apply to the `time_hi` field
42 *
43 * @return int The 16-bit time_hi field of the timestamp multiplexed with the UUID version number
44 *
45 * @pure
46 */
47 public static function applyVersion(int $timeHi, int $version) : int
48 {
49 return $timeHi & 0xfff | $version << 12;
50 }
51 }
52