PluginProbe
Media Cloud Sync / 1.2.9
Media Cloud Sync v1.2.9
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 1.2.9 All 35 releases
media-cloud-sync / includes / sdk / google / ramsey / uuid / src / BinaryUtils.php

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

59 lines 1.7 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 <ben@benramsey.com>
10 * @license http://opensource.org/licenses/MIT MIT
11 */
12 declare (strict_types=1);
13 namespace Dudlewebs\WPMCS\Ramsey\Uuid;
14
15 /**
16 * Provides binary math utilities
17 */
18 class BinaryUtils
19 {
20 /**
21 * Applies the RFC 4122 variant field to the 16-bit clock sequence
22 *
23 * @link http://tools.ietf.org/html/rfc4122#section-4.1.1 RFC 4122, § 4.1.1: Variant
24 *
25 * @param int $clockSeq The 16-bit clock sequence value before the RFC 4122
26 * variant is applied
27 *
28 * @return int The 16-bit clock sequence multiplexed with the UUID variant
29 *
30 * @psalm-pure
31 */
32 public static function applyVariant(int $clockSeq): int
33 {
34 $clockSeq = $clockSeq & 0x3fff;
35 $clockSeq |= 0x8000;
36 return $clockSeq;
37 }
38 /**
39 * Applies the RFC 4122 version number to the 16-bit `time_hi_and_version` field
40 *
41 * @link http://tools.ietf.org/html/rfc4122#section-4.1.3 RFC 4122, § 4.1.3: Version
42 *
43 * @param int $timeHi The value of the 16-bit `time_hi_and_version` field
44 * before the RFC 4122 version is applied
45 * @param int $version The RFC 4122 version to apply to the `time_hi` field
46 *
47 * @return int The 16-bit time_hi field of the timestamp multiplexed with
48 * the UUID version number
49 *
50 * @psalm-pure
51 */
52 public static function applyVersion(int $timeHi, int $version): int
53 {
54 $timeHi = $timeHi & 0xfff;
55 $timeHi |= $version << 12;
56 return $timeHi;
57 }
58 }
59