public LongStruct AddingLongStruct() { LongStruct accumulator = default; for (int i = 0; i < samples.Length; i++) { accumulator = AddStructNoInline(accumulator, samples[i]); } return(accumulator); }
public void TestLongStructWithIn() { var a = new LongStruct(1); var b = new LongStruct(2); for (var i = 1000000000; i > 0; --i) { LongStruct.AddWithIn(a, b); } }
public static int test_47_pass_long_struct() { LongStruct s = new LongStruct(); s.i = 5; s.l = new LongStruct2(); s.l.l = 42; return(mono_test_marshal_long_struct(ref s)); }
public static DateTime ExtractDateTimeUtc(this Guid g) { var guidStruct = new GuidStruct { Value = g }; var longStruct = new LongStruct { B2 = guidStruct.BF, B3 = guidStruct.BE, B4 = guidStruct.BD, B5 = guidStruct.BC, B6 = guidStruct.BB, B7 = (byte)(guidStruct.BA & 0x0F) }; return new DateTime(longStruct.Value + UuidStartTicks, DateTimeKind.Utc); }// ExtractDateTimeUtc()
}// ExtractDateTimeUtc() #if Experimental /// <summary> /// Returns SMALLEST guid with an approximate utc timestamp. Useful for time-based database range searches. /// </summary> public static Guid LowerGuidForDateTimeUtc(DateTime utc) { var longStruct = new LongStruct { Value = utc.Ticks - UuidStartTicks }; var guidStruct = new GuidStruct { BA = (byte)(longStruct.B7 & 0x0F), BB = longStruct.B6, BC = longStruct.B5, BD = longStruct.B4, BE = longStruct.B3, BF = longStruct.B2 }; return guidStruct.Value; }// LowerGuidForDateTimeUtc()
}// LowerGuidForDateTimeUtc() /// <summary> /// Returns LARGEST guid with an approximate utc timestamp. Useful for time-based database range searches. /// </summary> public static Guid UpperGuidForDateTimeUtc(DateTime utc) { var longStruct = new LongStruct { Value = utc.Ticks - UuidStartTicks }; var guidStruct = new GuidStruct { IntValue0123 = -1, // 0xFF_FF_FF_FF ShortValue45 = -1, // 0xFF_FF B6 = 0xFF, B7 = 0xFF, B8 = 0xFF, B9 = 0xFF, BA = (byte)(longStruct.B7 | 0xF0), BB = longStruct.B6, BC = longStruct.B5, BD = longStruct.B4, BE = longStruct.B3, BF = longStruct.B2 }; return guidStruct.Value; }// UpperGuidForDateTimeUtc()
/// <summary> /// write a long struct /// </summary> /// <param name="data"></param> public void Write(ref long data) { if (Length + 8 > _Buffer.Length) { _capacity += 8; Resize(); } var value = new LongStruct() { Value = data }; _Buffer[Length] = value.Byte0; _Buffer[Length + 1] = value.Byte1; _Buffer[Length + 2] = value.Byte2; _Buffer[Length + 3] = value.Byte3; _Buffer[Length + 4] = value.Byte4; _Buffer[Length + 5] = value.Byte5; _Buffer[Length + 6] = value.Byte6; _Buffer[Length + 7] = value.Byte7; Length += 8; }
LongStruct AddStructNoInline(LongStruct a, long b) { return(new LongStruct(a.A + b)); }
public List<LongStruct> Test() { List<LongStruct> x = new List<LongStruct>(); for (int i = 0; i < 1; i++) { LongStruct ls = new LongStruct(); if (ls.s1_0 == null) ls.s1_0 = ""; if (ls.s1_1 == null) ls.s1_1 = ""; if (ls.i0 == 0) ls.i0 = 1; if (ls.i1 == 0) ls.i1 = 1; if (ls.i2 == 0) ls.i2 = 1; if (ls.i3 == 0) ls.i3 = 1; if (ls.i4 == 0) ls.i4 = 1; if (ls.i5 == 0) ls.i5 = 1; if (ls.i6 == 0) ls.i6 = 1; if (ls.i7 == 0) ls.i7 = 1; if (ls.i8 == 0) ls.i8 = 1; if (ls.i9 == 0) ls.i9 = 1; if (ls.i10 == 0) ls.i10 = 1; if (ls.i11 == 0) ls.i11 = 1; if (ls.i12 == 0) ls.i12 = 1; if (ls.i13 == 0) ls.i13 = 1; if (ls.i14 == 0) ls.i14 = 1; if (ls.i15 == 0) ls.i15 = 1; if (ls.i16 == 0) ls.i16 = 1; if (ls.i17 == 0) ls.i17 = 1; if (ls.i18 == 0) ls.i18 = 1; if (ls.i19 == 0) ls.i19 = 1; if (ls.i20 == 0) ls.i20 = 1; if (ls.i21 == 0) ls.i21 = 1; if (ls.i22 == 0) ls.i22 = 1; if (ls.i23 == 0) ls.i23 = 1; if (ls.i24 == 0) ls.i24 = 1; if (ls.i25 == 0) ls.i25 = 1; if (ls.i26 == 0) ls.i26 = 1; if (ls.i27 == 0) ls.i27 = 1; if (ls.i28 == 0) ls.i28 = 1; if (ls.i29 == 0) ls.i29 = 1; if (ls.i30 == 0) ls.i30 = 1; if (ls.i31 == 0) ls.i31 = 1; if (ls.i32 == 0) ls.i32 = 1; if (ls.i33 == 0) ls.i33 = 1; if (ls.i34 == 0) ls.i34 = 1; if (ls.i35 == 0) ls.i35 = 1; if (ls.i36 == 0) ls.i36 = 1; if (ls.i37 == 0) ls.i37 = 1; if (ls.i38 == 0) ls.i38 = 1; if (ls.i39 == 0) ls.i39 = 1; if (ls.i40 == 0) ls.i40 = 1; if (ls.i41 == 0) ls.i41 = 1; if (ls.i42 == 0) ls.i42 = 1; if (ls.i43 == 0) ls.i43 = 1; if (ls.i44 == 0) ls.i44 = 1; if (ls.i45 == 0) ls.i45 = 1; if (ls.i46 == 0) ls.i46 = 1; if (ls.i47 == 0) ls.i47 = 1; if (ls.i48 == 0) ls.i48 = 1; if (ls.i49 == 0) ls.i49 = 1; if (ls.i50 == 0) ls.i50 = 1; if (ls.i51 == 0) ls.i51 = 1; if (ls.i52 == 0) ls.i52 = 1; if (ls.i53 == 0) ls.i53 = 1; if (ls.i54 == 0) ls.i54 = 1; if (ls.i55 == 0) ls.i55 = 1; if (ls.i56 == 0) ls.i56 = 1; if (ls.i57 == 0) ls.i57 = 1; if (ls.i58 == 0) ls.i58 = 1; if (ls.i59 == 0) ls.i59 = 1; if (ls.i60 == 0) ls.i60 = 1; if (ls.i61 == 0) ls.i61 = 1; if (ls.i62 == 0) ls.i62 = 1; if (ls.i63 == 0) ls.i63 = 1; x.Add(ls); } GC.Collect(); GC.WaitForPendingFinalizers(); return x; }
public List <LongStruct> Test() { List <LongStruct> x = new List <LongStruct>(); for (int i = 0; i < 1; i++) { LongStruct ls = new LongStruct(); if (ls.s1_0 == null) { ls.s1_0 = ""; } if (ls.s1_1 == null) { ls.s1_1 = ""; } if (ls.i0 == 0) { ls.i0 = 1; } if (ls.i1 == 0) { ls.i1 = 1; } if (ls.i2 == 0) { ls.i2 = 1; } if (ls.i3 == 0) { ls.i3 = 1; } if (ls.i4 == 0) { ls.i4 = 1; } if (ls.i5 == 0) { ls.i5 = 1; } if (ls.i6 == 0) { ls.i6 = 1; } if (ls.i7 == 0) { ls.i7 = 1; } if (ls.i8 == 0) { ls.i8 = 1; } if (ls.i9 == 0) { ls.i9 = 1; } if (ls.i10 == 0) { ls.i10 = 1; } if (ls.i11 == 0) { ls.i11 = 1; } if (ls.i12 == 0) { ls.i12 = 1; } if (ls.i13 == 0) { ls.i13 = 1; } if (ls.i14 == 0) { ls.i14 = 1; } if (ls.i15 == 0) { ls.i15 = 1; } if (ls.i16 == 0) { ls.i16 = 1; } if (ls.i17 == 0) { ls.i17 = 1; } if (ls.i18 == 0) { ls.i18 = 1; } if (ls.i19 == 0) { ls.i19 = 1; } if (ls.i20 == 0) { ls.i20 = 1; } if (ls.i21 == 0) { ls.i21 = 1; } if (ls.i22 == 0) { ls.i22 = 1; } if (ls.i23 == 0) { ls.i23 = 1; } if (ls.i24 == 0) { ls.i24 = 1; } if (ls.i25 == 0) { ls.i25 = 1; } if (ls.i26 == 0) { ls.i26 = 1; } if (ls.i27 == 0) { ls.i27 = 1; } if (ls.i28 == 0) { ls.i28 = 1; } if (ls.i29 == 0) { ls.i29 = 1; } if (ls.i30 == 0) { ls.i30 = 1; } if (ls.i31 == 0) { ls.i31 = 1; } if (ls.i32 == 0) { ls.i32 = 1; } if (ls.i33 == 0) { ls.i33 = 1; } if (ls.i34 == 0) { ls.i34 = 1; } if (ls.i35 == 0) { ls.i35 = 1; } if (ls.i36 == 0) { ls.i36 = 1; } if (ls.i37 == 0) { ls.i37 = 1; } if (ls.i38 == 0) { ls.i38 = 1; } if (ls.i39 == 0) { ls.i39 = 1; } if (ls.i40 == 0) { ls.i40 = 1; } if (ls.i41 == 0) { ls.i41 = 1; } if (ls.i42 == 0) { ls.i42 = 1; } if (ls.i43 == 0) { ls.i43 = 1; } if (ls.i44 == 0) { ls.i44 = 1; } if (ls.i45 == 0) { ls.i45 = 1; } if (ls.i46 == 0) { ls.i46 = 1; } if (ls.i47 == 0) { ls.i47 = 1; } if (ls.i48 == 0) { ls.i48 = 1; } if (ls.i49 == 0) { ls.i49 = 1; } if (ls.i50 == 0) { ls.i50 = 1; } if (ls.i51 == 0) { ls.i51 = 1; } if (ls.i52 == 0) { ls.i52 = 1; } if (ls.i53 == 0) { ls.i53 = 1; } if (ls.i54 == 0) { ls.i54 = 1; } if (ls.i55 == 0) { ls.i55 = 1; } if (ls.i56 == 0) { ls.i56 = 1; } if (ls.i57 == 0) { ls.i57 = 1; } if (ls.i58 == 0) { ls.i58 = 1; } if (ls.i59 == 0) { ls.i59 = 1; } if (ls.i60 == 0) { ls.i60 = 1; } if (ls.i61 == 0) { ls.i61 = 1; } if (ls.i62 == 0) { ls.i62 = 1; } if (ls.i63 == 0) { ls.i63 = 1; } x.Add(ls); } GC.Collect(); GC.WaitForPendingFinalizers(); return(x); }
extern static int mono_test_marshal_long_struct(ref LongStruct s);