ItemAddress.h 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291
  1. #pragma once
  2. #include "CodeContract.h"
  3. #include "StandardIntegralTypes.h"
  4. namespace tecplot
  5. {
  6. #define SIZE_IN_BITS(___1837) (sizeof(___1837) * 8)
  7. #define VALID_ITEM_ADDRESS_PARTITION(itemAddressPartition) \
  8. ((itemAddressPartition) != tecplot::___2090::INVALID_PARTITION && \
  9. (SIZE_IN_BITS(tecplot::___2090::___2980) == tecplot::___2090::PartitionBitSize || \
  10. (SIZE_IN_BITS(tecplot::___2090::___2980) > tecplot::___2090::PartitionBitSize && \
  11. uint64_t(itemAddressPartition) >> tecplot::___2090::PartitionBitSize == uint64_t(0))))
  12. #define VALID_ITEM_ADDRESS_SUBZONE_OFFSET(itemAddressSubzoneOffset) \
  13. ((itemAddressSubzoneOffset) != tecplot::___2090::INVALID_SUBZONE_OFFSET && \
  14. (SIZE_IN_BITS(tecplot::___2090::SubzoneOffset_t) == tecplot::___2090::SubzoneOffsetBitSize || \
  15. (SIZE_IN_BITS(tecplot::___2090::SubzoneOffset_t) > tecplot::___2090::SubzoneOffsetBitSize && \
  16. uint64_t(itemAddressSubzoneOffset) >> tecplot::___2090::SubzoneOffsetBitSize == uint64_t(0))))
  17. #define VALID_ITEM_ADDRESS_ITEM_OFFSET(itemAddressItemOffset) \
  18. ((itemAddressItemOffset) != tecplot::___2090::INVALID_ITEM_OFFSET && \
  19. (SIZE_IN_BITS(tecplot::___2090::ItemOffset_t) == tecplot::___2090::ItemOffsetBitSize || \
  20. (SIZE_IN_BITS(tecplot::___2090::ItemOffset_t) > tecplot::___2090::ItemOffsetBitSize && \
  21. uint64_t(itemAddressItemOffset) >> tecplot::___2090::ItemOffsetBitSize == uint64_t(0))))
  22. #define VALID_UNIFORM_ITEM_ADDRESS(___2089) \
  23. ((___2089).___14() == tecplot::___2090::UniformAddressType)
  24. #define VALID_SZL_ITEM_ADDRESS(___2089) \
  25. ((___2089).___14() == tecplot::___2090::SzlAddressType && \
  26. VALID_ITEM_ADDRESS_PARTITION((___2089).___2977()) && \
  27. VALID_ITEM_ADDRESS_SUBZONE_OFFSET((___2089).subzoneOffset()) && \
  28. VALID_ITEM_ADDRESS_ITEM_OFFSET((___2089).itemOffset()))
  29. #define VALID_ITEM_ADDRESS(___2089) \
  30. (VALID_UNIFORM_ITEM_ADDRESS(___2089) || \
  31. VALID_SZL_ITEM_ADDRESS(___2089))
  32. #define VALID_ITEM_ADDRESS_SUBZONE_ADDRESS(subzoneAddress) \
  33. (VALID_ITEM_ADDRESS_PARTITION((subzoneAddress).___2977()) && \
  34. VALID_ITEM_ADDRESS_SUBZONE_OFFSET((subzoneAddress).subzoneOffset()))
  35. class ___2090
  36. {
  37. public:
  38. typedef uint32_t ___2980;
  39. typedef uint64_t SubzoneIndex_t;
  40. typedef uint32_t SubzoneOffset_t;
  41. typedef uint16_t ItemOffset_t;
  42. typedef int64_t ___4261;
  43. static uint32_t const ___15 = 1U;
  44. static uint32_t const PartitionBitSize = 23U;
  45. static uint32_t const SubzoneOffsetBitSize = 32U;
  46. static uint32_t const ItemOffsetBitSize = 8U;
  47. static uint32_t const ___4259 = 63U;
  48. static uint32_t const SzlAddressType = 0U;
  49. static uint32_t const UniformAddressType = 1U;
  50. static ___2980 const INVALID_PARTITION = static_cast<___2980>((uint64_t(1) << PartitionBitSize) - uint64_t(1));
  51. static ___2980 const UNKNOWN_PARTITION = 0;
  52. static ___2980 const MAX_PARTITION = INVALID_PARTITION - static_cast<___2980>(1);
  53. static SubzoneOffset_t const INVALID_SUBZONE_OFFSET = static_cast<SubzoneOffset_t>((uint64_t(1) << SubzoneOffsetBitSize) - uint64_t(1));
  54. static SubzoneOffset_t const MAX_SUBZONE_OFFSET = INVALID_SUBZONE_OFFSET - static_cast<SubzoneOffset_t>(1);
  55. static ItemOffset_t const INVALID_ITEM_OFFSET = static_cast<ItemOffset_t>((uint64_t(1) << ItemOffsetBitSize));
  56. static ItemOffset_t const MAX_ITEM_OFFSET = INVALID_ITEM_OFFSET - static_cast<ItemOffset_t>(1);
  57. class SubzoneAddress
  58. {
  59. public:
  60. inline SubzoneAddress() { INVARIANT(SIZE_IN_BITS(*this) == 64U); }
  61. inline SubzoneAddress(___2980 ___2977, SubzoneOffset_t subzoneOffset) : m_partition(___2977), m_subzoneOffset(subzoneOffset)
  62. {
  63. INVARIANT(SIZE_IN_BITS(*this) == 64U);
  64. REQUIRE(VALID_ITEM_ADDRESS_PARTITION(m_partition));
  65. REQUIRE(VALID_ITEM_ADDRESS_SUBZONE_OFFSET(m_subzoneOffset));
  66. }
  67. inline ___2980 ___2977() const
  68. {
  69. REQUIRE(VALID_ITEM_ADDRESS_PARTITION(m_partition));
  70. REQUIRE(VALID_ITEM_ADDRESS_SUBZONE_OFFSET(m_subzoneOffset));
  71. return m_partition;
  72. }
  73. inline SubzoneOffset_t subzoneOffset() const
  74. {
  75. REQUIRE(VALID_ITEM_ADDRESS_PARTITION(m_partition));
  76. REQUIRE(VALID_ITEM_ADDRESS_SUBZONE_OFFSET(m_subzoneOffset));
  77. return m_subzoneOffset;
  78. }
  79. inline bool operator==(SubzoneAddress const &___2888) const
  80. {
  81. REQUIRE(VALID_ITEM_ADDRESS_PARTITION(m_partition));
  82. REQUIRE(VALID_ITEM_ADDRESS_SUBZONE_OFFSET(m_subzoneOffset));
  83. return m_partition == ___2888.m_partition && m_subzoneOffset == ___2888.m_subzoneOffset;
  84. }
  85. private:
  86. ___2980 m_partition;
  87. SubzoneOffset_t m_subzoneOffset;
  88. };
  89. inline ___2090() { INVARIANT(___4306()); }
  90. inline ___2090(___2980 ___2977, SubzoneOffset_t subzoneOffset, ItemOffset_t itemOffset)
  91. {
  92. INVARIANT(___4306());
  93. REQUIRE(VALID_ITEM_ADDRESS_PARTITION(___2977));
  94. REQUIRE(VALID_ITEM_ADDRESS_SUBZONE_OFFSET(subzoneOffset));
  95. REQUIRE(VALID_ITEM_ADDRESS_ITEM_OFFSET(itemOffset));
  96. ___478(___15 + ___4259 == SIZE_IN_BITS(___2090));
  97. ___478(___15 + PartitionBitSize + SubzoneOffsetBitSize + ItemOffsetBitSize == SIZE_IN_BITS(___2090));
  98. m.___14 = SzlAddressType;
  99. m.szlItemAddress.___2977 = ___2977;
  100. m.szlItemAddress.subzoneOffset = subzoneOffset;
  101. m.szlItemAddress.itemOffset = itemOffset;
  102. }
  103. inline ___2090(SubzoneAddress subzoneAddress, ItemOffset_t itemOffset)
  104. {
  105. INVARIANT(___4306());
  106. REQUIRE(VALID_ITEM_ADDRESS_SUBZONE_ADDRESS(subzoneAddress));
  107. REQUIRE(VALID_ITEM_ADDRESS_ITEM_OFFSET(itemOffset));
  108. ___478(___15 + ___4259 == SIZE_IN_BITS(___2090));
  109. ___478(___15 + PartitionBitSize + SubzoneOffsetBitSize + ItemOffsetBitSize == SIZE_IN_BITS(___2090));
  110. m.___14 = SzlAddressType;
  111. m.szlItemAddress.___2977 = subzoneAddress.___2977();
  112. m.szlItemAddress.subzoneOffset = subzoneAddress.subzoneOffset();
  113. m.szlItemAddress.itemOffset = itemOffset;
  114. }
  115. inline explicit ___2090(___4261 ___4258)
  116. {
  117. INVARIANT(___4306());
  118. ___478(___15 + ___4259 == SIZE_IN_BITS(___2090));
  119. ___478(___15 + PartitionBitSize + SubzoneOffsetBitSize + ItemOffsetBitSize == SIZE_IN_BITS(___2090));
  120. m.___14 = UniformAddressType;
  121. m.___4256.___2865 = ___4258;
  122. }
  123. inline bool ___2065() const
  124. {
  125. ENSURE(m.___14 == SzlAddressType || m.___14 == UniformAddressType);
  126. return m.___14 == UniformAddressType;
  127. }
  128. inline bool isSzlItem() const
  129. {
  130. ENSURE(m.___14 == SzlAddressType || m.___14 == UniformAddressType);
  131. return m.___14 == SzlAddressType;
  132. }
  133. inline uint32_t ___14() const
  134. {
  135. ENSURE(m.___14 == SzlAddressType || m.___14 == UniformAddressType);
  136. return m.___14;
  137. }
  138. inline SubzoneAddress subzoneAddress() const
  139. {
  140. REQUIRE(m.___14 == SzlAddressType);
  141. return SubzoneAddress(m.szlItemAddress.___2977, m.szlItemAddress.subzoneOffset);
  142. }
  143. inline ___2980 ___2977() const
  144. {
  145. REQUIRE(m.___14 == SzlAddressType);
  146. ENSURE(VALID_ITEM_ADDRESS_PARTITION(m.szlItemAddress.___2977));
  147. return m.szlItemAddress.___2977;
  148. }
  149. inline SubzoneOffset_t subzoneOffset() const
  150. {
  151. REQUIRE(m.___14 == SzlAddressType);
  152. ENSURE(VALID_ITEM_ADDRESS_SUBZONE_OFFSET(m.szlItemAddress.subzoneOffset));
  153. return m.szlItemAddress.subzoneOffset;
  154. }
  155. inline ItemOffset_t itemOffset() const
  156. {
  157. REQUIRE(m.___14 == SzlAddressType);
  158. ENSURE(VALID_ITEM_ADDRESS_ITEM_OFFSET(m.szlItemAddress.itemOffset));
  159. return m.szlItemAddress.itemOffset;
  160. }
  161. inline ___4261 ___4258() const
  162. {
  163. REQUIRE(___2065());
  164. return m.___4256.___2865;
  165. }
  166. inline uint64_t toRawBits() const { return m.___3270; }
  167. static ___2090 fromRawBits(uint64_t ___3270)
  168. {
  169. ___2090 ___3358;
  170. ___3358.m.___3270 = ___3270;
  171. ENSURE(VALID_ITEM_ADDRESS(___3358));
  172. return ___3358;
  173. }
  174. inline bool operator==(___2090 const &___2888) const
  175. {
  176. REQUIRE(VALID_ITEM_ADDRESS(___2888));
  177. return m.___3270 == ___2888.m.___3270;
  178. }
  179. private:
  180. #if !defined NO_ASSERTS
  181. static bool ___4306()
  182. {
  183. return (SIZE_IN_BITS(___2090) <= 64U && SIZE_IN_BITS(___2980) >= PartitionBitSize && SIZE_IN_BITS(SubzoneOffset_t) >= SubzoneOffsetBitSize && SIZE_IN_BITS(ItemOffset_t) > ItemOffsetBitSize && SIZE_IN_BITS(___4261) >= ___4259 && ___15 + ___4259 == SIZE_IN_BITS(___2090) && ___15 + PartitionBitSize + SubzoneOffsetBitSize + ItemOffsetBitSize == SIZE_IN_BITS(___2090));
  184. }
  185. #endif
  186. struct SzlItemAddress_s
  187. {
  188. uint64_t ___14 : ___15;
  189. uint64_t ___2977 : PartitionBitSize;
  190. uint64_t subzoneOffset : SubzoneOffsetBitSize;
  191. uint64_t itemOffset : ItemOffsetBitSize;
  192. };
  193. struct ___4257
  194. {
  195. int64_t ___14 : ___15;
  196. int64_t ___2865 : ___4259;
  197. };
  198. union
  199. {
  200. uint64_t ___14 : ___15;
  201. SzlItemAddress_s szlItemAddress;
  202. ___4257 ___4256;
  203. uint64_t ___3270;
  204. } m;
  205. };
  206. inline bool operator<(___2090 const &___2229, ___2090 const &___3392)
  207. {
  208. REQUIRE(VALID_ITEM_ADDRESS(___2229));
  209. REQUIRE(VALID_ITEM_ADDRESS(___3392));
  210. uint32_t const ___2230 = ___2229.___14();
  211. uint32_t const ___3393 = ___3392.___14();
  212. if (___2230 != ___3393)
  213. {
  214. return ___2230 < ___3393;
  215. }
  216. else if (___2230 == tecplot::___2090::UniformAddressType)
  217. {
  218. return ___2229.___4258() < ___3392.___4258();
  219. }
  220. else if (___2229.___2977() == ___3392.___2977())
  221. {
  222. if (___2229.subzoneOffset() == ___3392.subzoneOffset())
  223. return ___2229.itemOffset() < ___3392.itemOffset();
  224. else
  225. return ___2229.subzoneOffset() < ___3392.subzoneOffset();
  226. }
  227. else
  228. {
  229. return ___2229.___2977() < ___3392.___2977();
  230. }
  231. }
  232. inline bool operator!=(___2090 const &___2229, ___2090 const &___3392)
  233. {
  234. REQUIRE(VALID_ITEM_ADDRESS(___2229));
  235. REQUIRE(VALID_ITEM_ADDRESS(___3392));
  236. return !(___2229 == ___3392);
  237. }
  238. inline bool operator<=(___2090 const &___2229, ___2090 const &___3392)
  239. {
  240. REQUIRE(VALID_ITEM_ADDRESS(___2229));
  241. REQUIRE(VALID_ITEM_ADDRESS(___3392));
  242. return ___2229 < ___3392 || ___2229 == ___3392;
  243. }
  244. inline bool operator>(___2090 const &___2229, ___2090 const &___3392)
  245. {
  246. REQUIRE(VALID_ITEM_ADDRESS(___2229));
  247. REQUIRE(VALID_ITEM_ADDRESS(___3392));
  248. return !(___2229 < ___3392) && !(___2229 == ___3392);
  249. }
  250. inline bool operator>=(___2090 const &___2229, ___2090 const &___3392)
  251. {
  252. REQUIRE(VALID_ITEM_ADDRESS(___2229));
  253. REQUIRE(VALID_ITEM_ADDRESS(___3392));
  254. return !(___2229 < ___3392);
  255. }
  256. inline bool operator<(___2090::SubzoneAddress const &___2229, ___2090::SubzoneAddress const &___3392)
  257. {
  258. REQUIRE(VALID_ITEM_ADDRESS_SUBZONE_ADDRESS(___2229));
  259. REQUIRE(VALID_ITEM_ADDRESS_SUBZONE_ADDRESS(___3392));
  260. if (___2229.___2977() == ___3392.___2977())
  261. return ___2229.subzoneOffset() < ___3392.subzoneOffset();
  262. else
  263. return ___2229.___2977() < ___3392.___2977();
  264. }
  265. inline bool operator!=(___2090::SubzoneAddress const &___2229, ___2090::SubzoneAddress const &___3392)
  266. {
  267. REQUIRE(VALID_ITEM_ADDRESS_SUBZONE_ADDRESS(___2229));
  268. REQUIRE(VALID_ITEM_ADDRESS_SUBZONE_ADDRESS(___3392));
  269. return !(___2229 == ___3392);
  270. }
  271. inline bool operator<=(___2090::SubzoneAddress const &___2229, ___2090::SubzoneAddress const &___3392)
  272. {
  273. REQUIRE(VALID_ITEM_ADDRESS_SUBZONE_ADDRESS(___2229));
  274. REQUIRE(VALID_ITEM_ADDRESS_SUBZONE_ADDRESS(___3392));
  275. return ___2229 < ___3392 || ___2229 == ___3392;
  276. }
  277. inline bool operator>(___2090::SubzoneAddress const &___2229, ___2090::SubzoneAddress const &___3392)
  278. {
  279. REQUIRE(VALID_ITEM_ADDRESS_SUBZONE_ADDRESS(___2229));
  280. REQUIRE(VALID_ITEM_ADDRESS_SUBZONE_ADDRESS(___3392));
  281. return !(___2229 < ___3392) && !(___2229 == ___3392);
  282. }
  283. inline bool operator>=(___2090::SubzoneAddress const &___2229, ___2090::SubzoneAddress const &___3392)
  284. {
  285. REQUIRE(VALID_ITEM_ADDRESS_SUBZONE_ADDRESS(___2229));
  286. REQUIRE(VALID_ITEM_ADDRESS_SUBZONE_ADDRESS(___3392));
  287. return !(___2229 < ___3392);
  288. }
  289. }