1818//
1919#endregion -- License Terms --
2020
21+ #if UNITY_STANDALONE || UNITY_WEBPLAYER || UNITY_WII || UNITY_IPHONE || UNITY_ANDROID || UNITY_PS3 || UNITY_XBOX360 || UNITY_FLASH || UNITY_BKACKBERRY || UNITY_WINRT
22+ #define UNITY
23+ #endif
24+
2125using System ;
22- #if ! UNITY_ANDROID && ! UNITY_IPHONE
26+ #if ! UNITY
2327using System . Diagnostics . Contracts ;
24- #endif // !UNITY_ANDROID && !UNITY_IPHONE
28+ #endif // !UNITY
2529
2630namespace MsgPack
2731{
@@ -32,9 +36,9 @@ internal static class BigEndianBinary
3236 {
3337 public static sbyte ToSByte ( byte [ ] buffer , int offset )
3438 {
35- #if ! UNITY_ANDROID && ! UNITY_IPHONE
39+ #if ! UNITY
3640 Contract . Assume ( buffer . Length >= offset + sizeof ( sbyte ) ) ;
37- #endif // !UNITY_ANDROID && !UNITY_IPHONE
41+ #endif // !UNITY
3842
3943 unchecked
4044 {
@@ -44,9 +48,9 @@ public static sbyte ToSByte( byte[] buffer, int offset )
4448
4549 public static short ToInt16 ( byte [ ] buffer , int offset )
4650 {
47- #if ! UNITY_ANDROID && ! UNITY_IPHONE
51+ #if ! UNITY
4852 Contract . Assume ( buffer . Length >= offset + sizeof ( short ) ) ;
49- #endif // !UNITY_ANDROID && !UNITY_IPHONE
53+ #endif // !UNITY
5054
5155 unchecked
5256 {
@@ -56,9 +60,9 @@ public static short ToInt16( byte[] buffer, int offset )
5660
5761 public static int ToInt32 ( byte [ ] buffer , int offset )
5862 {
59- #if ! UNITY_ANDROID && ! UNITY_IPHONE
63+ #if ! UNITY
6064 Contract . Assume ( buffer . Length >= offset + sizeof ( int ) ) ;
61- #endif // !UNITY_ANDROID && !UNITY_IPHONE
65+ #endif // !UNITY
6266
6367 unchecked
6468 {
@@ -68,9 +72,9 @@ public static int ToInt32( byte[] buffer, int offset )
6872
6973 public static long ToInt64 ( byte [ ] buffer , int offset )
7074 {
71- #if ! UNITY_ANDROID && ! UNITY_IPHONE
75+ #if ! UNITY
7276 Contract . Assume ( buffer . Length >= offset + sizeof ( long ) ) ;
73- #endif // !UNITY_ANDROID && !UNITY_IPHONE
77+ #endif // !UNITY
7478
7579 unchecked
7680 {
@@ -82,18 +86,18 @@ public static long ToInt64( byte[] buffer, int offset )
8286
8387 public static byte ToByte ( byte [ ] buffer , int offset )
8488 {
85- #if ! UNITY_ANDROID && ! UNITY_IPHONE
89+ #if ! UNITY
8690 Contract . Assume ( buffer . Length >= offset + sizeof ( byte ) ) ;
87- #endif // !UNITY_ANDROID && !UNITY_IPHONE
91+ #endif // !UNITY
8892
8993 return buffer [ offset ] ;
9094 }
9195
9296 public static ushort ToUInt16 ( byte [ ] buffer , int offset )
9397 {
94- #if ! UNITY_ANDROID && ! UNITY_IPHONE
98+ #if ! UNITY
9599 Contract . Assume ( buffer . Length >= offset + sizeof ( ushort ) ) ;
96- #endif // !UNITY_ANDROID && !UNITY_IPHONE
100+ #endif // !UNITY
97101
98102 unchecked
99103 {
@@ -103,9 +107,9 @@ public static ushort ToUInt16( byte[] buffer, int offset )
103107
104108 public static uint ToUInt32 ( byte [ ] buffer , int offset )
105109 {
106- #if ! UNITY_ANDROID && ! UNITY_IPHONE
110+ #if ! UNITY
107111 Contract . Assume ( buffer . Length >= offset + sizeof ( uint ) ) ;
108- #endif // !UNITY_ANDROID && !UNITY_IPHONE
112+ #endif // !UNITY
109113
110114 unchecked
111115 {
@@ -115,9 +119,9 @@ public static uint ToUInt32( byte[] buffer, int offset )
115119
116120 public static ulong ToUInt64 ( byte [ ] buffer , int offset )
117121 {
118- #if ! UNITY_ANDROID && ! UNITY_IPHONE
122+ #if ! UNITY
119123 Contract . Assume ( buffer . Length >= offset + sizeof ( ulong ) ) ;
120- #endif // !UNITY_ANDROID && !UNITY_IPHONE
124+ #endif // !UNITY
121125
122126 unchecked
123127 {
0 commit comments