aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/ramsey/uuid/src/BinaryUtils.php
diff options
context:
space:
mode:
authorMax Kostikov <max@kostikov.co>2018-09-28 15:46:14 +0200
committerMax Kostikov <max@kostikov.co>2018-09-28 15:46:14 +0200
commit4a904fa3a8af1c101ede76657249fb7eb47faf60 (patch)
tree544509813fb68579ef2b556ce879a971d183269a /vendor/ramsey/uuid/src/BinaryUtils.php
parentf5f6ec3d71acb3e0488386819d5060e59331ec23 (diff)
parentc13d7e29ef9676b0f0e4ae23aa52e203f4ad8895 (diff)
downloadvolse-hubzilla-4a904fa3a8af1c101ede76657249fb7eb47faf60.tar.gz
volse-hubzilla-4a904fa3a8af1c101ede76657249fb7eb47faf60.tar.bz2
volse-hubzilla-4a904fa3a8af1c101ede76657249fb7eb47faf60.zip
Merge branch 'patch-29' into 'dev'
Patch 29 See merge request Kostikov/core!3
Diffstat (limited to 'vendor/ramsey/uuid/src/BinaryUtils.php')
-rw-r--r--vendor/ramsey/uuid/src/BinaryUtils.php43
1 files changed, 43 insertions, 0 deletions
diff --git a/vendor/ramsey/uuid/src/BinaryUtils.php b/vendor/ramsey/uuid/src/BinaryUtils.php
new file mode 100644
index 000000000..f04a9d9c1
--- /dev/null
+++ b/vendor/ramsey/uuid/src/BinaryUtils.php
@@ -0,0 +1,43 @@
+<?php
+
+namespace Ramsey\Uuid;
+
+/**
+ * Provides binary math utilities
+ */
+class BinaryUtils
+{
+ /**
+ * Applies the RFC 4122 variant field to the `clock_seq_hi_and_reserved` field
+ *
+ * @param $clockSeqHi
+ * @return int The high field of the clock sequence multiplexed with the variant
+ * @link http://tools.ietf.org/html/rfc4122#section-4.1.1
+ */
+ public static function applyVariant($clockSeqHi)
+ {
+ // Set the variant to RFC 4122
+ $clockSeqHi = $clockSeqHi & 0x3f;
+ $clockSeqHi &= ~(0xc0);
+ $clockSeqHi |= 0x80;
+
+ return $clockSeqHi;
+ }
+
+ /**
+ * Applies the RFC 4122 version number to the `time_hi_and_version` field
+ *
+ * @param string $timeHi
+ * @param integer $version
+ * @return int The high field of the timestamp multiplexed with the version number
+ * @link http://tools.ietf.org/html/rfc4122#section-4.1.3
+ */
+ public static function applyVersion($timeHi, $version)
+ {
+ $timeHi = hexdec($timeHi) & 0x0fff;
+ $timeHi &= ~(0xf000);
+ $timeHi |= $version << 12;
+
+ return $timeHi;
+ }
+}