Skip to content

Commit 6a012bf

Browse files
committed
DateTimeOffsetFieldAccessor: Fixed size of value to 16
1 parent f1a1651 commit 6a012bf

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

Orm/Xtensive.Orm/Tuples/Packed/PackedFieldAccessor.cs

+5-1
Original file line numberDiff line numberDiff line change
@@ -578,7 +578,11 @@ protected override void Encode(DateTimeOffset value, long[] values, int offset)
578578

579579
private static unsafe int GetSize()
580580
{
581-
return sizeof(DateTimeOffset);
581+
// Depending on architecture, x86 or x64, the size of DateTimeOffset is either 12 or 16 respectively.
582+
// Due to the fact that Rank calculation algorithm expects sizes to be equal to one of the power of two
583+
// it returns wrong rank value for size 12 (bitsize = 96) which causes wrong choice of Encode/Decode methods.
584+
// Setting it to 16 helps to solve Rank problem.
585+
return sizeof(long) * 2;
582586
}
583587

584588
public DateTimeOffsetFieldAccessor()

0 commit comments

Comments
 (0)