VLink  2.3.0
A high-performance communication middleware
uint128.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2026 by Thun Lu. All rights reserved.
3  * Author: Thun Lu <thun.lu@zohomail.cn>
4  * Repo: https://github.com/thun-res/vlink
5  * _ __ __ _ __
6  * | | / / / / (_) ____ / /__
7  * | | / / / / / / / __ \ / //_/
8  * | |/ / / /___ / / / / / / / ,<
9  * |___/ /_____/ /_/ /_/ /_/ /_/|_|
10  *
11  * Licensed under the Apache License, Version 2.0 (the "License");
12  * you may not use this file except in compliance with the License.
13  * You may obtain a copy of the License at
14  *
15  * http://www.apache.org/licenses/LICENSE-2.0
16  *
17  * Unless required by applicable law or agreed to in writing, software
18  * distributed under the License is distributed on an "AS IS" BASIS,
19  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
20  * See the License for the specific language governing permissions and
21  * limitations under the License.
22  */
23 
24 /**
25  * @file uint128.h
26  * @brief Portable 128-bit unsigned integer with native-fastpath multiplication.
27  *
28  * @details
29  * @c vlink::Uint128 stores the value as a pair of @c uint64_t halves (@c high_, @c low_).
30  * On GCC and Clang 64-bit targets the multiplication, division and modulo paths delegate
31  * to the compiler-native @c __uint128_t for maximum performance; on platforms without
32  * that builtin the portable fallback (@c mul_u128_fallback / @c u128_divmod) is used.
33  *
34  * Supported operator set:
35  *
36  * | Category | Operators | Notes |
37  * | ---------- | -------------------------------------- | ------------------------------------ |
38  * | Arithmetic | + - * / % += -= *= /= %= | Division throws on divisor @c 0 |
39  * | Bitwise | OR AND XOR NOT shift compound-assign | Shifts clamp to @c [0, @c 128] |
40  * | Comparison | == != < > <= >= | Lexicographic over (high, low) |
41  * | Increment | ++ -- (prefix and postfix) | Carry/borrow crosses the 64-bit line |
42  * | Stream | operator<<(std::ostream&) | Uppercase hexadecimal output |
43  *
44  * @par Implicit construction from integral types
45  * The single-argument constructor is intentionally non-explicit so integral literals can
46  * flow into @c Uint128 transparently. Signed source values are sign-extended, unsigned
47  * values are zero-extended, and native @c __uint128_t / @c __int128_t values are split into
48  * halves.
49  *
50  * @par Conversion back to @c __uint128_t
51  * An explicit @c operator @c __uint128_t() is provided on platforms that expose the type.
52  *
53  * @par std::hash specialisation
54  * A @c std::hash<vlink::Uint128> specialisation at the bottom of this file enables use
55  * inside @c std::unordered_map and @c std::unordered_set.
56  *
57  * @par Example
58  * @code
59  * vlink::Uint128 a(0, UINT64_MAX);
60  * vlink::Uint128 b(1, 0);
61  * vlink::Uint128 c = a + vlink::Uint128(0, 1);
62  * assert(c == b);
63  *
64  * std::unordered_map<vlink::uint128_t, std::string> map;
65  * map[vlink::Uint128(0xDEAD, 0xBEEF)] = "key";
66  * @endcode
67  */
68 
69 #pragma once
70 
71 #include <cstddef>
72 #include <cstdint>
73 #include <ostream>
74 #include <type_traits>
75 #include <utility>
76 
77 #include "./macros.h"
78 
79 namespace vlink {
80 
81 /**
82  * @class Uint128
83  * @brief 128-bit unsigned integer represented as two 64-bit halves with full operator support.
84  *
85  * @details
86  * Logical layout is @c (high_ @c << @c 64) @c | @c low_. All arithmetic propagates carry
87  * and borrow across the 64-bit boundary so the observable behaviour matches a true
88  * 128-bit unsigned integer.
89  */
90 class Uint128 final {
91  public:
92  /**
93  * @brief Default-constructs a zero-valued @c Uint128.
94  */
95  Uint128() noexcept = default;
96 
97  /**
98  * @brief Constructs from an integral-like type @p T (implicit on purpose).
99  *
100  * @details
101  * - When @c T is @c __uint128_t or @c __int128_t (where available), the source is split into
102  * halves.
103  * - When @c T is signed the source is sign-extended: a negative value yields
104  * @c high_ @c = @c ~uint64_t{0} and @c low_ @c = the two's-complement bit pattern.
105  * - When @c T is unsigned the source is zero-extended into @c low_ with @c high_ @c = @c 0.
106  * - Any other @p T is rejected at compile time by a @c static_assert.
107  *
108  * @tparam T Source type (integral, @c __uint128_t or @c __int128_t).
109  * @param v Source value.
110  *
111  * @note Non-explicit by design so integral literals interoperate naturally.
112  */
113  template <typename T>
114  constexpr Uint128(T v) noexcept; // NOLINT(google-explicit-constructor)
115 
116  /**
117  * @brief Constructs from explicit high and low halves.
118  *
119  * @param high Upper 64 bits.
120  * @param low Lower 64 bits.
121  */
122  explicit Uint128(uint64_t high, uint64_t low) noexcept;
123 
124 #if defined(__SIZEOF_INT128__)
125  /**
126  * @brief Converts to the compiler-native @c __uint128_t type.
127  *
128  * @details
129  * Only available where @c __uint128_t exists (GCC/Clang 64-bit targets).
130  *
131  * @return Reconstructed native 128-bit value.
132  */
133  explicit operator __uint128_t() const noexcept;
134 #endif
135 
136  /**
137  * @brief Returns the sum of @c *this and @p other.
138  *
139  * @param other Right operand.
140  * @return New value equal to @c *this + @p other (wraps on overflow).
141  */
142  Uint128 operator+(const Uint128& other) const noexcept;
143 
144  /**
145  * @brief Returns the difference of @c *this and @p other.
146  *
147  * @param other Right operand.
148  * @return New value equal to @c *this - @p other (wraps on underflow).
149  */
150  Uint128 operator-(const Uint128& other) const noexcept;
151 
152  /**
153  * @brief Returns the product of @c *this and @p other.
154  *
155  * @details
156  * Delegates to native @c __uint128_t multiplication when available; otherwise falls
157  * back to @c mul_u128_fallback.
158  *
159  * @param other Right operand.
160  * @return Low 128 bits of the true product.
161  */
162  Uint128 operator*(const Uint128& other) const noexcept;
163 
164  /**
165  * @brief Returns the quotient of @c *this divided by @p other.
166  *
167  * @param other Divisor.
168  * @return Quotient.
169  *
170  * @throws std::domain_error when @p other is zero.
171  */
172  Uint128 operator/(const Uint128& other) const;
173 
174  /**
175  * @brief Returns the remainder of @c *this divided by @p other.
176  *
177  * @param other Divisor.
178  * @return Remainder.
179  *
180  * @throws std::domain_error when @p other is zero.
181  */
182  Uint128 operator%(const Uint128& other) const;
183 
184  /**
185  * @brief Adds @p other to @c *this in-place with carry propagation.
186  *
187  * @param other Right operand.
188  * @return Reference to @c *this.
189  */
190  Uint128& operator+=(const Uint128& other) noexcept;
191 
192  /**
193  * @brief Subtracts @p other from @c *this in-place with borrow propagation.
194  *
195  * @param other Right operand.
196  * @return Reference to @c *this.
197  */
198  Uint128& operator-=(const Uint128& other) noexcept;
199 
200  /**
201  * @brief Multiplies @c *this by @p other in-place.
202  *
203  * @param other Right operand.
204  * @return Reference to @c *this.
205  */
206  Uint128& operator*=(const Uint128& other) noexcept;
207 
208  /**
209  * @brief Divides @c *this by @p other in-place.
210  *
211  * @param other Divisor.
212  * @return Reference to @c *this.
213  *
214  * @throws std::domain_error when @p other is zero.
215  */
216  Uint128& operator/=(const Uint128& other);
217 
218  /**
219  * @brief Computes @c *this modulo @p other in-place.
220  *
221  * @param other Divisor.
222  * @return Reference to @c *this.
223  *
224  * @throws std::domain_error when @p other is zero.
225  */
226  Uint128& operator%=(const Uint128& other);
227 
228  /**
229  * @brief Returns the bitwise OR of @c *this and @p other.
230  *
231  * @param other Right operand.
232  * @return New value with each bit set if it is set in either operand.
233  */
234  Uint128 operator|(const Uint128& other) const noexcept;
235 
236  /**
237  * @brief Returns the bitwise AND of @c *this and @p other.
238  *
239  * @param other Right operand.
240  * @return New value with each bit set only when set in both operands.
241  */
242  Uint128 operator&(const Uint128& other) const noexcept;
243 
244  /**
245  * @brief Returns the bitwise XOR of @c *this and @p other.
246  *
247  * @param other Right operand.
248  * @return New value with each bit set when the bits differ between operands.
249  */
250  Uint128 operator^(const Uint128& other) const noexcept;
251 
252  /**
253  * @brief Returns the bitwise complement of @c *this.
254  *
255  * @return New value with all 128 bits inverted.
256  */
257  Uint128 operator~() const noexcept;
258 
259  /**
260  * @brief Returns @c *this shifted left by @p shift bits.
261  *
262  * @details
263  * Shift values @c <= @c 0 leave the value unchanged; @c >= @c 128 produce zero; values
264  * in @c [64, @c 127] move bits across the 64-bit boundary.
265  *
266  * @param shift Bit positions to shift.
267  * @return Shifted value.
268  */
269  Uint128 operator<<(int shift) const noexcept;
270 
271  /**
272  * @brief Returns @c *this shifted right by @p shift bits (logical, zero-fill).
273  *
274  * @details
275  * Same edge-case rules as @c operator<<.
276  *
277  * @param shift Bit positions to shift.
278  * @return Shifted value.
279  */
280  Uint128 operator>>(int shift) const noexcept;
281 
282  /**
283  * @brief Applies bitwise OR with @p other in-place.
284  *
285  * @param other Right operand.
286  * @return Reference to @c *this.
287  */
288  Uint128& operator|=(const Uint128& other) noexcept;
289 
290  /**
291  * @brief Applies bitwise AND with @p other in-place.
292  *
293  * @param other Right operand.
294  * @return Reference to @c *this.
295  */
296  Uint128& operator&=(const Uint128& other) noexcept;
297 
298  /**
299  * @brief Applies bitwise XOR with @p other in-place.
300  *
301  * @param other Right operand.
302  * @return Reference to @c *this.
303  */
304  Uint128& operator^=(const Uint128& other) noexcept;
305 
306  /**
307  * @brief Shifts @c *this left by @p shift bits in-place.
308  *
309  * @param shift Bit positions to shift.
310  * @return Reference to @c *this.
311  */
312  Uint128& operator<<=(int shift) noexcept;
313 
314  /**
315  * @brief Shifts @c *this right by @p shift bits in-place (logical, zero-fill).
316  *
317  * @param shift Bit positions to shift.
318  * @return Reference to @c *this.
319  */
320  Uint128& operator>>=(int shift) noexcept;
321 
322  /**
323  * @brief Returns @c true when both halves of @c *this and @p other are equal.
324  *
325  * @param other Right operand.
326  * @return Equality result.
327  */
328  [[nodiscard]] bool operator==(const Uint128& other) const noexcept;
329 
330  /**
331  * @brief Returns @c true when any half differs.
332  *
333  * @param other Right operand.
334  * @return Inequality result.
335  */
336  [[nodiscard]] bool operator!=(const Uint128& other) const noexcept;
337 
338  /**
339  * @brief Returns @c true when @c *this is strictly less than @p other.
340  *
341  * @details
342  * Compares the high half first; ties are broken by the low half.
343  *
344  * @param other Right operand.
345  * @return Comparison result.
346  */
347  [[nodiscard]] bool operator<(const Uint128& other) const noexcept;
348 
349  /**
350  * @brief Returns @c true when @c *this is strictly greater than @p other.
351  *
352  * @param other Right operand.
353  * @return Comparison result.
354  */
355  [[nodiscard]] bool operator>(const Uint128& other) const noexcept;
356 
357  /**
358  * @brief Returns @c true when @c *this is less than or equal to @p other.
359  *
360  * @param other Right operand.
361  * @return Comparison result.
362  */
363  [[nodiscard]] bool operator<=(const Uint128& other) const noexcept;
364 
365  /**
366  * @brief Returns @c true when @c *this is greater than or equal to @p other.
367  *
368  * @param other Right operand.
369  * @return Comparison result.
370  */
371  [[nodiscard]] bool operator>=(const Uint128& other) const noexcept;
372 
373  /**
374  * @brief Pre-increment with carry across the 64-bit boundary.
375  *
376  * @return Reference to the incremented value.
377  */
378  Uint128& operator++() noexcept;
379 
380  /**
381  * @brief Post-increment returning a copy of the value prior to incrementing.
382  *
383  * @return Pre-increment value.
384  */
385  Uint128 operator++(int) noexcept;
386 
387  /**
388  * @brief Pre-decrement with borrow across the 64-bit boundary.
389  *
390  * @return Reference to the decremented value.
391  */
392  Uint128& operator--() noexcept;
393 
394  /**
395  * @brief Post-decrement returning a copy of the value prior to decrementing.
396  *
397  * @return Pre-decrement value.
398  */
399  Uint128 operator--(int) noexcept;
400 
401  /**
402  * @brief Returns the upper 64 bits of the stored value.
403  *
404  * @return High half.
405  */
406  [[nodiscard]] uint64_t get_high() const noexcept;
407 
408  /**
409  * @brief Returns the lower 64 bits of the stored value.
410  *
411  * @return Low half.
412  */
413  [[nodiscard]] uint64_t get_low() const noexcept;
414 
415  /**
416  * @brief Writes the uppercase hexadecimal representation of @p value to @p os.
417  *
418  * @param os Output stream.
419  * @param value Value to print.
420  * @return Reference to @p os.
421  */
422  VLINK_EXPORT friend std::ostream& operator<<(std::ostream& os, const Uint128& value);
423 
424  private:
425  VLINK_EXPORT static int clz64(uint64_t x) noexcept;
426 
427  VLINK_EXPORT static void mul_64_128(uint64_t a, uint64_t b, uint64_t& hi, uint64_t& lo) noexcept;
428 
429  VLINK_EXPORT static uint64_t add64_carry(uint64_t a, uint64_t b, uint64_t& carry_out) noexcept;
430 
431  VLINK_EXPORT static void add_128_with64(uint64_t& high, uint64_t& low, uint64_t add_low,
432  uint64_t add_high = 0) noexcept;
433 
434  VLINK_EXPORT static Uint128 mul_u128_fallback(const Uint128& x, const Uint128& y) noexcept;
435 
436  VLINK_EXPORT static std::pair<Uint128, Uint128> u128_divmod(const Uint128& dividend, const Uint128& divisor);
437 
438  uint64_t high_{0};
439  uint64_t low_{0};
440 };
441 
442 /**
443  * @brief Convenience alias matching the lowercase fixed-width style of the standard integer types.
444  */
446 
447 ////////////////////////////////////////////////////////////////
448 /// Details
449 ////////////////////////////////////////////////////////////////
450 
451 template <typename T>
452 inline constexpr Uint128::Uint128(T v) noexcept {
453 #if defined(__SIZEOF_INT128__)
454  static_assert(std::is_integral_v<T> || std::is_same_v<__uint128_t, T> || std::is_same_v<__int128_t, T>,
455  "Uint128(T): T must be an integral type");
456 #else
457  static_assert(std::is_integral_v<T>, "Uint128(T): T must be an integral type");
458 #endif
459 
460 #if defined(__SIZEOF_INT128__)
461  if constexpr (std::is_same_v<__uint128_t, T> || std::is_same_v<__int128_t, T>) {
462  const auto value = static_cast<__uint128_t>(v);
463  high_ = static_cast<uint64_t>(value >> 64);
464  low_ = static_cast<uint64_t>(value);
465 
466  return;
467  }
468 #endif
469 
470  if constexpr (std::is_constructible_v<uint64_t, T>) {
471  if constexpr (std::is_signed_v<T>) {
472  high_ = (v < 0) ? ~uint64_t{0} : uint64_t{0};
473  low_ = static_cast<uint64_t>(static_cast<int64_t>(v));
474  } else {
475  high_ = 0;
476  low_ = v;
477  }
478  }
479 }
480 
481 inline Uint128::Uint128(uint64_t high, uint64_t low) noexcept : high_(high), low_(low) {}
482 
483 #if defined(__SIZEOF_INT128__)
484 inline Uint128::operator __uint128_t() const noexcept { return (static_cast<__uint128_t>(high_) << 64) | low_; }
485 #endif
486 
487 inline Uint128 Uint128::operator+(const Uint128& other) const noexcept {
488  Uint128 r = *this;
489  r += other;
490 
491  return r;
492 }
493 
494 inline Uint128 Uint128::operator-(const Uint128& other) const noexcept {
495  Uint128 r = *this;
496  r -= other;
497 
498  return r;
499 }
500 
501 inline Uint128 Uint128::operator*(const Uint128& other) const noexcept {
502  Uint128 r = *this;
503  r *= other;
504 
505  return r;
506 }
507 
508 inline Uint128 Uint128::operator/(const Uint128& other) const { return u128_divmod(*this, other).first; }
509 
510 inline Uint128 Uint128::operator%(const Uint128& other) const { return u128_divmod(*this, other).second; }
511 
512 inline Uint128& Uint128::operator+=(const Uint128& other) noexcept {
513  uint64_t old_low = low_;
514 
515  low_ += other.low_;
516 
517  uint64_t carry = (low_ < old_low) ? 1 : 0;
518 
519  high_ += other.high_ + carry;
520 
521  return *this;
522 }
523 
524 inline Uint128& Uint128::operator-=(const Uint128& other) noexcept {
525  uint64_t borrow = (low_ < other.low_) ? 1 : 0;
526 
527  low_ -= other.low_;
528  high_ = high_ - other.high_ - borrow;
529 
530  return *this;
531 }
532 
533 inline Uint128& Uint128::operator*=(const Uint128& other) noexcept {
534 #if defined(__SIZEOF_INT128__)
535  __uint128_t lhs = (static_cast<__uint128_t>(high_) << 64) | low_;
536  __uint128_t rhs = (static_cast<__uint128_t>(other.high_) << 64) | other.low_;
537  __uint128_t res = lhs * rhs;
538 
539  high_ = static_cast<uint64_t>(res >> 64);
540  low_ = static_cast<uint64_t>(res);
541 #else
542  Uint128 r = mul_u128_fallback(*this, other);
543 
544  high_ = r.high_;
545  low_ = r.low_;
546 #endif
547  return *this;
548 }
549 
550 inline Uint128& Uint128::operator/=(const Uint128& other) {
551  auto qr = u128_divmod(*this, other);
552 
553  high_ = qr.first.high_;
554  low_ = qr.first.low_;
555 
556  return *this;
557 }
558 
559 inline Uint128& Uint128::operator%=(const Uint128& other) {
560  auto qr = u128_divmod(*this, other);
561 
562  high_ = qr.second.high_;
563  low_ = qr.second.low_;
564 
565  return *this;
566 }
567 
568 inline Uint128 Uint128::operator|(const Uint128& other) const noexcept {
569  return Uint128(high_ | other.high_, low_ | other.low_);
570 }
571 
572 inline Uint128 Uint128::operator&(const Uint128& other) const noexcept {
573  return Uint128(high_ & other.high_, low_ & other.low_);
574 }
575 
576 inline Uint128 Uint128::operator^(const Uint128& other) const noexcept {
577  return Uint128(high_ ^ other.high_, low_ ^ other.low_);
578 }
579 
580 inline Uint128 Uint128::operator~() const noexcept { return Uint128(~high_, ~low_); }
581 
582 inline Uint128 Uint128::operator<<(int shift) const noexcept {
583  if (shift <= 0) {
584  return *this;
585  }
586 
587  if (shift >= 128) {
588  return Uint128(0, 0);
589  }
590 
591  if (shift >= 64) {
592  return Uint128(low_ << (shift - 64), 0);
593  }
594 
595  uint64_t new_high = (high_ << shift) | (low_ >> (64 - shift));
596  uint64_t new_low = low_ << shift;
597 
598  return Uint128(new_high, new_low);
599 }
600 
601 inline Uint128 Uint128::operator>>(int shift) const noexcept {
602  if (shift <= 0) {
603  return *this;
604  }
605 
606  if (shift >= 128) {
607  return Uint128(0, 0);
608  }
609 
610  if (shift >= 64) {
611  return Uint128(0, high_ >> (shift - 64));
612  }
613 
614  uint64_t new_low = (low_ >> shift) | (high_ << (64 - shift));
615  uint64_t new_high = high_ >> shift;
616 
617  return Uint128(new_high, new_low);
618 }
619 
620 inline Uint128& Uint128::operator|=(const Uint128& other) noexcept {
621  high_ |= other.high_;
622  low_ |= other.low_;
623 
624  return *this;
625 }
626 
627 inline Uint128& Uint128::operator&=(const Uint128& other) noexcept {
628  high_ &= other.high_;
629  low_ &= other.low_;
630 
631  return *this;
632 }
633 
634 inline Uint128& Uint128::operator^=(const Uint128& other) noexcept {
635  high_ ^= other.high_;
636  low_ ^= other.low_;
637 
638  return *this;
639 }
640 
641 inline Uint128& Uint128::operator<<=(int shift) noexcept {
642  if (shift <= 0) {
643  return *this;
644  }
645 
646  if (shift >= 128) {
647  high_ = 0;
648  low_ = 0;
649 
650  return *this;
651  }
652 
653  if (shift >= 64) {
654  high_ = (low_ << (shift - 64));
655  low_ = 0;
656  } else {
657  uint64_t nh = (high_ << shift) | (low_ >> (64 - shift));
658  uint64_t nl = low_ << shift;
659 
660  high_ = nh;
661  low_ = nl;
662  }
663 
664  return *this;
665 }
666 
667 inline Uint128& Uint128::operator>>=(int shift) noexcept {
668  if (shift <= 0) {
669  return *this;
670  }
671 
672  if (shift >= 128) {
673  high_ = 0;
674  low_ = 0;
675  return *this;
676  }
677 
678  if (shift >= 64) {
679  low_ = (high_ >> (shift - 64));
680  high_ = 0;
681  } else {
682  uint64_t nl = (low_ >> shift) | (high_ << (64 - shift));
683  uint64_t nh = high_ >> shift;
684 
685  high_ = nh;
686  low_ = nl;
687  }
688 
689  return *this;
690 }
691 
692 inline bool Uint128::operator==(const Uint128& other) const noexcept {
693  return high_ == other.high_ && low_ == other.low_;
694 }
695 
696 inline bool Uint128::operator!=(const Uint128& other) const noexcept { return !(*this == other); }
697 
698 inline bool Uint128::operator<(const Uint128& other) const noexcept {
699  return (high_ < other.high_) || (high_ == other.high_ && low_ < other.low_);
700 }
701 
702 inline bool Uint128::operator>(const Uint128& other) const noexcept { return other < *this; }
703 
704 inline bool Uint128::operator<=(const Uint128& other) const noexcept { return !(other < *this); }
705 
706 inline bool Uint128::operator>=(const Uint128& other) const noexcept { return !(*this < other); }
707 
708 inline Uint128& Uint128::operator++() noexcept {
709  uint64_t old_low = low_;
710 
711  low_ += 1;
712 
713  if (low_ < old_low) {
714  ++high_;
715  }
716 
717  return *this;
718 }
719 
720 inline Uint128 Uint128::operator++(int) noexcept {
721  Uint128 tmp = *this;
722 
723  ++(*this);
724 
725  return tmp;
726 }
727 
728 inline Uint128& Uint128::operator--() noexcept {
729  uint64_t old_low = low_;
730  low_ -= 1;
731 
732  if (old_low == 0) {
733  --high_;
734  }
735 
736  return *this;
737 }
738 
739 inline Uint128 Uint128::operator--(int) noexcept {
740  Uint128 tmp = *this;
741 
742  --(*this);
743 
744  return tmp;
745 }
746 
747 inline uint64_t Uint128::get_high() const noexcept { return high_; }
748 
749 inline uint64_t Uint128::get_low() const noexcept { return low_; }
750 
751 } // namespace vlink
752 
753 namespace std {
754 
755 /**
756  * @brief @c std::hash specialisation enabling @c vlink::Uint128 keys in unordered containers.
757  *
758  * @details
759  * The hash combines both 64-bit halves so @c std::unordered_map, @c std::unordered_set and
760  * similar containers can key on a @c vlink::Uint128 directly.
761  */
762 template <>
763 struct hash<vlink::Uint128> {
764  /**
765  * @brief Hashes @p value into a @c size_t.
766  *
767  * @param value Value to hash.
768  * @return Hash derived from both halves.
769  */
770  VLINK_EXPORT size_t operator()(const vlink::Uint128& value) const noexcept;
771 };
772 
773 } // namespace std
Cross-platform macros for visibility, branch hints, copy prevention, singletons and string helpers.
#define VLINK_EXPORT
Definition: macros.h:81