static void Set128(this SerializedProperty property, uint bitIndex, bool value)
        {
            long  versionedData1 = property.FindPropertyRelative("data1").longValue;
            long  versionedData2 = property.FindPropertyRelative("data2").longValue;
            ulong trueData1;
            ulong trueData2;

            unsafe
            {
                trueData1 = *(ulong *)(&versionedData1);
                trueData2 = *(ulong *)(&versionedData2);
            }
            BitArrayUtilities.Set128(bitIndex, ref trueData1, ref trueData2, value);
            unsafe
            {
                versionedData1 = *(long *)(&trueData1);
                versionedData2 = *(long *)(&trueData2);
            }
            property.FindPropertyRelative("data1").longValue = versionedData1;
            property.FindPropertyRelative("data2").longValue = versionedData2;
        }
Exemplo n.º 2
0
 /// <summary>Set the bit at given index</summary>
 /// <param name="bitIndex">The index</param>
 /// <param name="value">The value</param>
 protected override void SetBitAt_Internal(uint bitIndex, bool value)
 {
     foreach (var property in GetOrInitializeSerializedProperties())
     {
         long  versionedData1 = property.FindPropertyRelative("data1").longValue;
         long  versionedData2 = property.FindPropertyRelative("data2").longValue;
         ulong trueData1;
         ulong trueData2;
         unsafe
         {
             trueData1 = *(ulong *)(&versionedData1);
             trueData2 = *(ulong *)(&versionedData2);
         }
         BitArrayUtilities.Set128(bitIndex, ref trueData1, ref trueData2, value);
         unsafe
         {
             versionedData1 = *(long *)(&trueData1);
             versionedData2 = *(long *)(&trueData2);
         }
         property.FindPropertyRelative("data1").longValue = versionedData1;
         property.FindPropertyRelative("data2").longValue = versionedData2;
     }
     ResyncSerialization();
 }