Skip to content

Commit

Permalink
Updated preprocessor directives to use built-in NETSTANDARD2_0 symbol
Browse files Browse the repository at this point in the history
  • Loading branch information
ritchiecarroll committed Jan 17, 2020
1 parent b2ef36e commit eb99468
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 22 deletions.
4 changes: 0 additions & 4 deletions src/Gemstone.PQDIF/Gemstone.PQDIF.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,6 @@
<DebugType>Full</DebugType>
</PropertyGroup>

<PropertyGroup Condition="'$(TargetFramework)' == 'netstandard2.0'">
<DefineConstants>NETSTANDARD20</DefineConstants>
</PropertyGroup>

<ItemGroup>
<None Include="..\..\docs\img\gemstone-square-128.png" Link="gemstone-square-128.png" Visible="false">
<Pack>True</Pack>
Expand Down
20 changes: 10 additions & 10 deletions src/Gemstone.PQDIF/Physical/ScalarElement.cs
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ public ushort GetUInt2()
value.CopyTo(copy);
copy.Reverse();

#if NETSTANDARD20
#if NETSTANDARD2_0
return BitConverter.ToUInt16(copy.ToArray(), 0);
#else
return BitConverter.ToUInt16(copy);
Expand Down Expand Up @@ -278,7 +278,7 @@ public short GetInt2()
value.CopyTo(copy);
copy.Reverse();

#if NETSTANDARD20
#if NETSTANDARD2_0
return BitConverter.ToInt16(copy.ToArray(), 0);
#else
return BitConverter.ToInt16(copy);
Expand Down Expand Up @@ -313,7 +313,7 @@ public uint GetUInt4()
value.CopyTo(copy);
copy.Reverse();

#if NETSTANDARD20
#if NETSTANDARD2_0
return BitConverter.ToUInt32(copy.ToArray(), 0);
#else
return BitConverter.ToUInt32(copy);
Expand Down Expand Up @@ -348,7 +348,7 @@ public int GetInt4()
value.CopyTo(copy);
copy.Reverse();

#if NETSTANDARD20
#if NETSTANDARD2_0
return BitConverter.ToInt32(copy.ToArray(), 0);
#else
return BitConverter.ToInt32(copy);
Expand Down Expand Up @@ -383,7 +383,7 @@ public bool GetBool4()
value.CopyTo(copy);
copy.Reverse();

#if NETSTANDARD20
#if NETSTANDARD2_0
return BitConverter.ToInt32(copy.ToArray(), 0) != 0;
#else
return BitConverter.ToInt32(copy) != 0;
Expand Down Expand Up @@ -418,7 +418,7 @@ public float GetReal4()
value.CopyTo(copy);
copy.Reverse();

#if NETSTANDARD20
#if NETSTANDARD2_0
return BitConverter.ToSingle(copy.ToArray(), 0);
#else
return BitConverter.ToSingle(copy);
Expand Down Expand Up @@ -453,7 +453,7 @@ public double GetReal8()
value.CopyTo(copy);
copy.Reverse();

#if NETSTANDARD20
#if NETSTANDARD2_0
return BitConverter.ToDouble(copy.ToArray(), 0);
#else
return BitConverter.ToDouble(copy);
Expand Down Expand Up @@ -497,7 +497,7 @@ public Complex GetComplex8()
imaginarySpan = imaginarySwap;
}

#if NETSTANDARD20
#if NETSTANDARD2_0
double real = BitConverter.ToSingle(realSpan.ToArray(), 0);
double imaginary = BitConverter.ToSingle(imaginarySpan.ToArray(), 0);
#else
Expand Down Expand Up @@ -550,7 +550,7 @@ public Complex GetComplex16()
imaginarySpan = imaginarySwap;
}

#if NETSTANDARD20
#if NETSTANDARD2_0
double real = BitConverter.ToDouble(realSpan.ToArray(), 0);
double imaginary = BitConverter.ToDouble(imaginarySpan.ToArray(), 0);
#else
Expand Down Expand Up @@ -613,7 +613,7 @@ public DateTime GetTimestamp()
secondSpan.Reverse();
}

#if NETSTANDARD20
#if NETSTANDARD2_0
uint days = BitConverter.ToUInt32(daySpan.ToArray(), 0);
double seconds = BitConverter.ToDouble(secondSpan.ToArray(), 0);
#else
Expand Down
16 changes: 8 additions & 8 deletions src/Gemstone.PQDIF/Physical/VectorElement.cs
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ public ushort GetUInt2(int index)
value.CopyTo(copy);
copy.Reverse();

#if NETSTANDARD20
#if NETSTANDARD2_0
return BitConverter.ToUInt16(copy.ToArray(), 0);
#else
return BitConverter.ToUInt16(copy);
Expand Down Expand Up @@ -325,7 +325,7 @@ public uint GetUInt4(int index)
value.CopyTo(copy);
copy.Reverse();

#if NETSTANDARD20
#if NETSTANDARD2_0
return BitConverter.ToUInt32(copy.ToArray(), 0);
#else
return BitConverter.ToUInt32(copy);
Expand Down Expand Up @@ -380,7 +380,7 @@ public short GetInt2(int index)
value.CopyTo(copy);
copy.Reverse();

#if NETSTANDARD20
#if NETSTANDARD2_0
return BitConverter.ToInt16(copy.ToArray(), 0);
#else
return BitConverter.ToInt16(copy);
Expand Down Expand Up @@ -421,7 +421,7 @@ public int GetInt4(int index)
value.CopyTo(copy);
copy.Reverse();

#if NETSTANDARD20
#if NETSTANDARD2_0
return BitConverter.ToInt32(copy.ToArray(), 0);
#else
return BitConverter.ToInt32(copy);
Expand Down Expand Up @@ -462,7 +462,7 @@ public float GetReal4(int index)
value.CopyTo(copy);
copy.Reverse();

#if NETSTANDARD20
#if NETSTANDARD2_0
return BitConverter.ToSingle(copy.ToArray(), 0);
#else
return BitConverter.ToSingle(copy);
Expand Down Expand Up @@ -503,7 +503,7 @@ public double GetReal8(int index)
value.CopyTo(copy);
copy.Reverse();

#if NETSTANDARD20
#if NETSTANDARD2_0
return BitConverter.ToDouble(copy.ToArray(), 0);
#else
return BitConverter.ToDouble(copy);
Expand Down Expand Up @@ -556,7 +556,7 @@ public DateTime GetTimestamp(int index)
secondSpan = secondSwap;
}

#if NETSTANDARD20
#if NETSTANDARD2_0
uint days = BitConverter.ToUInt32(daySpan.ToArray(), 0);
double seconds = BitConverter.ToDouble(secondSpan.ToArray(), 0);
#else
Expand Down Expand Up @@ -625,7 +625,7 @@ public Guid GetGuid(int index)
Span<byte> copy = new byte[size];
int byteIndex = index * size;
Values.AsSpan().Slice(byteIndex, size).CopyTo(copy);
#if NETSTANDARD20
#if NETSTANDARD2_0
return new Guid(copy.ToArray());
#else
return new Guid(copy);
Expand Down

0 comments on commit eb99468

Please sign in to comment.