github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library@v0.2.0/StandardLibrary_UInt/StandardLibrary_UInt.go (about) 1 // Package StandardLibrary_UInt 2 // Dafny module StandardLibrary_UInt compiled into Go 3 4 package StandardLibrary_UInt 5 6 import ( 7 os "os" 8 9 m_BoundedInts "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/BoundedInts" 10 m_DivInternals "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/DivInternals" 11 m_DivInternalsNonlinear "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/DivInternalsNonlinear" 12 m_DivMod "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/DivMod" 13 m_FileIO "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/FileIO" 14 m_Functions "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Functions" 15 m_GeneralInternals "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/GeneralInternals" 16 m_Logarithm "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Logarithm" 17 m__Math "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Math_" 18 m_ModInternals "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/ModInternals" 19 m_ModInternalsNonlinear "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/ModInternalsNonlinear" 20 m_Mul "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Mul" 21 m_MulInternals "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/MulInternals" 22 m_MulInternalsNonlinear "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/MulInternalsNonlinear" 23 m_Power "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Power" 24 m_Relations "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Relations" 25 m_Seq "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Seq" 26 m_Seq_MergeSort "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Seq_MergeSort" 27 m_StandardLibraryInterop "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/StandardLibraryInterop" 28 m_UnicodeStrings "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/UnicodeStrings" 29 m__Unicode "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Unicode_" 30 m_Utf16EncodingForm "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Utf16EncodingForm" 31 m_Utf8EncodingForm "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Utf8EncodingForm" 32 m_Wrappers "github.com/aws/aws-cryptographic-material-providers-library/releases/go/smithy-dafny-standard-library/Wrappers" 33 m__System "github.com/dafny-lang/DafnyRuntimeGo/v4/System_" 34 _dafny "github.com/dafny-lang/DafnyRuntimeGo/v4/dafny" 35 ) 36 37 var _ = os.Args 38 var _ _dafny.Dummy__ 39 var _ m__System.Dummy__ 40 var _ m_Wrappers.Dummy__ 41 var _ m_Relations.Dummy__ 42 var _ m_Seq_MergeSort.Dummy__ 43 var _ m__Math.Dummy__ 44 var _ m_Seq.Dummy__ 45 var _ m_BoundedInts.Dummy__ 46 var _ m__Unicode.Dummy__ 47 var _ m_Functions.Dummy__ 48 var _ m_Utf8EncodingForm.Dummy__ 49 var _ m_Utf16EncodingForm.Dummy__ 50 var _ m_UnicodeStrings.Dummy__ 51 var _ m_FileIO.Dummy__ 52 var _ m_GeneralInternals.Dummy__ 53 var _ m_MulInternalsNonlinear.Dummy__ 54 var _ m_MulInternals.Dummy__ 55 var _ m_Mul.Dummy__ 56 var _ m_ModInternalsNonlinear.Dummy__ 57 var _ m_DivInternalsNonlinear.Dummy__ 58 var _ m_ModInternals.Dummy__ 59 var _ m_DivInternals.Dummy__ 60 var _ m_DivMod.Dummy__ 61 var _ m_Power.Dummy__ 62 var _ m_Logarithm.Dummy__ 63 var _ m_StandardLibraryInterop.Dummy__ 64 65 type Dummy__ struct{} 66 67 // Definition of class Default__ 68 type Default__ struct { 69 dummy byte 70 } 71 72 func New_Default___() *Default__ { 73 _this := Default__{} 74 75 return &_this 76 } 77 78 type CompanionStruct_Default___ struct { 79 } 80 81 var Companion_Default___ = CompanionStruct_Default___{} 82 83 func (_this *Default__) Equals(other *Default__) bool { 84 return _this == other 85 } 86 87 func (_this *Default__) EqualsGeneric(x interface{}) bool { 88 other, ok := x.(*Default__) 89 return ok && _this.Equals(other) 90 } 91 92 func (*Default__) String() string { 93 return "StandardLibrary_UInt.Default__" 94 } 95 func (_this *Default__) ParentTraits_() []*_dafny.TraitID { 96 return [](*_dafny.TraitID){} 97 } 98 99 var _ _dafny.TraitOffspring = &Default__{} 100 101 func (_static *CompanionStruct_Default___) UInt8Less(a uint8, b uint8) bool { 102 return (a) < (b) 103 } 104 func (_static *CompanionStruct_Default___) HasUint16Len(s _dafny.Sequence) bool { 105 return (_dafny.IntOfUint32((s).Cardinality())).Cmp(Companion_Default___.UINT16__LIMIT()) < 0 106 } 107 func (_static *CompanionStruct_Default___) HasUint32Len(s _dafny.Sequence) bool { 108 return (_dafny.IntOfUint32((s).Cardinality())).Cmp(Companion_Default___.UINT32__LIMIT()) < 0 109 } 110 func (_static *CompanionStruct_Default___) HasUint64Len(s _dafny.Sequence) bool { 111 return (_dafny.IntOfUint32((s).Cardinality())).Cmp(Companion_Default___.UINT64__LIMIT()) < 0 112 } 113 func (_static *CompanionStruct_Default___) UInt16ToSeq(x uint16) _dafny.Sequence { 114 var _0_b0 uint8 = uint8((x) / (uint16(256))) 115 _ = _0_b0 116 var _1_b1 uint8 = uint8((x) % (uint16(256))) 117 _ = _1_b1 118 return _dafny.SeqOf(_0_b0, _1_b1) 119 } 120 func (_static *CompanionStruct_Default___) SeqToUInt16(s _dafny.Sequence) uint16 { 121 var _0_x0 uint16 = (uint16((s).Select(0).(uint8))) * (uint16(256)) 122 _ = _0_x0 123 return (_0_x0) + (uint16((s).Select(1).(uint8))) 124 } 125 func (_static *CompanionStruct_Default___) UInt32ToSeq(x uint32) _dafny.Sequence { 126 var _0_b0 uint8 = uint8((x) / (uint32(16777216))) 127 _ = _0_b0 128 var _1_x0 uint32 = (x) - (func() uint32 { return ((uint32(_0_b0)) * (uint32(16777216))) })() 129 _ = _1_x0 130 var _2_b1 uint8 = uint8((_1_x0) / (uint32(65536))) 131 _ = _2_b1 132 var _3_x1 uint32 = (_1_x0) - (func() uint32 { return ((uint32(_2_b1)) * (uint32(65536))) })() 133 _ = _3_x1 134 var _4_b2 uint8 = uint8((_3_x1) / (uint32(256))) 135 _ = _4_b2 136 var _5_b3 uint8 = uint8((_3_x1) % (uint32(256))) 137 _ = _5_b3 138 return _dafny.SeqOf(_0_b0, _2_b1, _4_b2, _5_b3) 139 } 140 func (_static *CompanionStruct_Default___) SeqToUInt32(s _dafny.Sequence) uint32 { 141 var _0_x0 uint32 = (uint32((s).Select(0).(uint8))) * (uint32(16777216)) 142 _ = _0_x0 143 var _1_x1 uint32 = (_0_x0) + ((uint32((s).Select(1).(uint8))) * (uint32(65536))) 144 _ = _1_x1 145 var _2_x2 uint32 = (_1_x1) + ((uint32((s).Select(2).(uint8))) * (uint32(256))) 146 _ = _2_x2 147 return (_2_x2) + (uint32((s).Select(3).(uint8))) 148 } 149 func (_static *CompanionStruct_Default___) UInt64ToSeq(x uint64) _dafny.Sequence { 150 var _0_b0 uint8 = uint8((x) / (uint64(72057594037927936))) 151 _ = _0_b0 152 var _1_x0 uint64 = (x) - (func() uint64 { return ((uint64(_0_b0)) * (uint64(72057594037927936))) })() 153 _ = _1_x0 154 var _2_b1 uint8 = uint8((_1_x0) / (uint64(281474976710656))) 155 _ = _2_b1 156 var _3_x1 uint64 = (_1_x0) - (func() uint64 { return ((uint64(_2_b1)) * (uint64(281474976710656))) })() 157 _ = _3_x1 158 var _4_b2 uint8 = uint8((_3_x1) / (uint64(1099511627776))) 159 _ = _4_b2 160 var _5_x2 uint64 = (_3_x1) - (func() uint64 { return ((uint64(_4_b2)) * (uint64(1099511627776))) })() 161 _ = _5_x2 162 var _6_b3 uint8 = uint8((_5_x2) / (uint64(4294967296))) 163 _ = _6_b3 164 var _7_x3 uint64 = (_5_x2) - (func() uint64 { return ((uint64(_6_b3)) * (uint64(4294967296))) })() 165 _ = _7_x3 166 var _8_b4 uint8 = uint8((_7_x3) / (uint64(16777216))) 167 _ = _8_b4 168 var _9_x4 uint64 = (_7_x3) - (func() uint64 { return ((uint64(_8_b4)) * (uint64(16777216))) })() 169 _ = _9_x4 170 var _10_b5 uint8 = uint8((_9_x4) / (uint64(65536))) 171 _ = _10_b5 172 var _11_x5 uint64 = (_9_x4) - (func() uint64 { return ((uint64(_10_b5)) * (uint64(65536))) })() 173 _ = _11_x5 174 var _12_b6 uint8 = uint8((_11_x5) / (uint64(256))) 175 _ = _12_b6 176 var _13_b7 uint8 = uint8((_11_x5) % (uint64(256))) 177 _ = _13_b7 178 return _dafny.SeqOf(_0_b0, _2_b1, _4_b2, _6_b3, _8_b4, _10_b5, _12_b6, _13_b7) 179 } 180 func (_static *CompanionStruct_Default___) SeqToUInt64(s _dafny.Sequence) uint64 { 181 var _0_x0 uint64 = (uint64((s).Select(0).(uint8))) * (uint64(72057594037927936)) 182 _ = _0_x0 183 var _1_x1 uint64 = (_0_x0) + ((uint64((s).Select(1).(uint8))) * (uint64(281474976710656))) 184 _ = _1_x1 185 var _2_x2 uint64 = (_1_x1) + ((uint64((s).Select(2).(uint8))) * (uint64(1099511627776))) 186 _ = _2_x2 187 var _3_x3 uint64 = (_2_x2) + ((uint64((s).Select(3).(uint8))) * (uint64(4294967296))) 188 _ = _3_x3 189 var _4_x4 uint64 = (_3_x3) + ((uint64((s).Select(4).(uint8))) * (uint64(16777216))) 190 _ = _4_x4 191 var _5_x5 uint64 = (_4_x4) + ((uint64((s).Select(5).(uint8))) * (uint64(65536))) 192 _ = _5_x5 193 var _6_x6 uint64 = (_5_x5) + ((uint64((s).Select(6).(uint8))) * (uint64(256))) 194 _ = _6_x6 195 var _7_x uint64 = (_6_x6) + (uint64((s).Select(7).(uint8))) 196 _ = _7_x 197 return _7_x 198 } 199 func (_static *CompanionStruct_Default___) UINT16__LIMIT() _dafny.Int { 200 return (_dafny.IntOfUint16(m_BoundedInts.Companion_Default___.UINT16__MAX())).Plus(_dafny.One) 201 } 202 func (_static *CompanionStruct_Default___) UINT32__LIMIT() _dafny.Int { 203 return (_dafny.IntOfUint32(m_BoundedInts.Companion_Default___.UINT32__MAX())).Plus(_dafny.One) 204 } 205 func (_static *CompanionStruct_Default___) UINT64__LIMIT() _dafny.Int { 206 return (_dafny.IntOfUint64(m_BoundedInts.Companion_Default___.UINT64__MAX())).Plus(_dafny.One) 207 } 208 func (_static *CompanionStruct_Default___) INT32__MAX__LIMIT() _dafny.Int { 209 return _dafny.IntOfInt32(m_BoundedInts.Companion_Default___.INT32__MAX()) 210 } 211 func (_static *CompanionStruct_Default___) INT64__MAX__LIMIT() _dafny.Int { 212 return _dafny.IntOfInt64(m_BoundedInts.Companion_Default___.INT64__MAX()) 213 } 214 func (_static *CompanionStruct_Default___) UINT64__MAX__LIMIT() _dafny.Int { 215 return _dafny.IntOfUint64(m_BoundedInts.Companion_Default___.UINT64__MAX()) 216 } 217 218 // End of class Default__ 219 220 // Definition of class Seq16 221 type Seq16 struct { 222 } 223 224 func New_Seq16_() *Seq16 { 225 _this := Seq16{} 226 227 return &_this 228 } 229 230 type CompanionStruct_Seq16_ struct { 231 } 232 233 var Companion_Seq16_ = CompanionStruct_Seq16_{} 234 235 func (*Seq16) String() string { 236 return "StandardLibrary_UInt.Seq16" 237 } 238 239 // End of class Seq16 240 241 func Type_Seq16_(Type_T_ _dafny.TypeDescriptor) _dafny.TypeDescriptor { 242 return type_Seq16_{Type_T_} 243 } 244 245 type type_Seq16_ struct { 246 Type_T_ _dafny.TypeDescriptor 247 } 248 249 func (_this type_Seq16_) Default() interface{} { 250 Type_T_ := _this.Type_T_ 251 _ = Type_T_ 252 return _dafny.EmptySeq 253 } 254 255 func (_this type_Seq16_) String() string { 256 return "StandardLibrary_UInt.Seq16" 257 } 258 func (_this *CompanionStruct_Seq16_) Is_(__source _dafny.Sequence) bool { 259 var _0_s _dafny.Sequence = (__source) 260 _ = _0_s 261 return Companion_Default___.HasUint16Len(_0_s) 262 } 263 264 // Definition of class Seq32 265 type Seq32 struct { 266 } 267 268 func New_Seq32_() *Seq32 { 269 _this := Seq32{} 270 271 return &_this 272 } 273 274 type CompanionStruct_Seq32_ struct { 275 } 276 277 var Companion_Seq32_ = CompanionStruct_Seq32_{} 278 279 func (*Seq32) String() string { 280 return "StandardLibrary_UInt.Seq32" 281 } 282 283 // End of class Seq32 284 285 func Type_Seq32_(Type_T_ _dafny.TypeDescriptor) _dafny.TypeDescriptor { 286 return type_Seq32_{Type_T_} 287 } 288 289 type type_Seq32_ struct { 290 Type_T_ _dafny.TypeDescriptor 291 } 292 293 func (_this type_Seq32_) Default() interface{} { 294 Type_T_ := _this.Type_T_ 295 _ = Type_T_ 296 return _dafny.EmptySeq 297 } 298 299 func (_this type_Seq32_) String() string { 300 return "StandardLibrary_UInt.Seq32" 301 } 302 func (_this *CompanionStruct_Seq32_) Is_(__source _dafny.Sequence) bool { 303 var _1_s _dafny.Sequence = (__source) 304 _ = _1_s 305 return Companion_Default___.HasUint32Len(_1_s) 306 } 307 308 // Definition of class Seq64 309 type Seq64 struct { 310 } 311 312 func New_Seq64_() *Seq64 { 313 _this := Seq64{} 314 315 return &_this 316 } 317 318 type CompanionStruct_Seq64_ struct { 319 } 320 321 var Companion_Seq64_ = CompanionStruct_Seq64_{} 322 323 func (*Seq64) String() string { 324 return "StandardLibrary_UInt.Seq64" 325 } 326 327 // End of class Seq64 328 329 func Type_Seq64_(Type_T_ _dafny.TypeDescriptor) _dafny.TypeDescriptor { 330 return type_Seq64_{Type_T_} 331 } 332 333 type type_Seq64_ struct { 334 Type_T_ _dafny.TypeDescriptor 335 } 336 337 func (_this type_Seq64_) Default() interface{} { 338 Type_T_ := _this.Type_T_ 339 _ = Type_T_ 340 return _dafny.EmptySeq 341 } 342 343 func (_this type_Seq64_) String() string { 344 return "StandardLibrary_UInt.Seq64" 345 } 346 func (_this *CompanionStruct_Seq64_) Is_(__source _dafny.Sequence) bool { 347 var _2_s _dafny.Sequence = (__source) 348 _ = _2_s 349 return Companion_Default___.HasUint64Len(_2_s) 350 }