/// <summary>
            /// Applied before SetTag runs.
            /// </summary>
            internal static bool Prefix(ref ulong ___bits7, Tag tag)
            {
                var  inst    = ExtendedTagBits.Instance;
                int  index   = inst.ManifestFlagIndex(tag) - ExtendedTagBits.VANILLA_LIMIT;
                bool vanilla = index < 0;

                if (!vanilla)
                {
                    int id = inst.GetIDWithTagSet(TagBitOps.GetUpperBits(___bits7), index);
                    ___bits7 = (___bits7 & 0xFFFFFFFFUL) | ((ulong)id << 32);
                }
                return(vanilla);
            }
Exemplo n.º 2
0
            /// <summary>
            /// Applied before Clear runs.
            /// </summary>
            internal static bool Prefix(ref ulong ___bits5, Tag tag)
            {
                var  inst    = ExtendedTagBits.Instance;
                int  index   = inst.ManifestFlagIndex(tag) - ExtendedTagBits.VANILLA_LIMIT;
                bool vanilla = index < 0;

                if (!vanilla && ___bits5 != 0UL)
                {
                    int id = inst.GetIDWithTagClear(TagBitOps.GetUpperBits(___bits5), index);
                    ___bits5 = TagBitOps.GetLowerBits(___bits5) | ((ulong)id << 32);
                }
                return(vanilla);
            }
            /// <summary>
            /// Applied before GetTagsVerySlow runs.
            /// </summary>
            internal static bool Prefix(int bits_idx, ulong bits, List <Tag> tags)
            {
                bool extended = bits_idx >= 5;
                var  inst = ExtendedTagBits.Instance;
                int  ubits = TagBitOps.GetUpperBits(bits), nlower = extended ? 32 : 64,
                     baseIdx = BitSet.ULONG_BITS * bits_idx;

                // Vanilla tags in lowest N bits
                for (int i = 0; i < nlower; i++)
                {
                    if ((bits & 1UL) != 0UL)
                    {
                        var tag = inst.GetTagForIndex(baseIdx + i);
                        if (tag != Tag.Invalid)
                        {
                            tags.Add(tag);
                        }
                    }
                    bits >>= 1;
                }
                // Extended tags in highest bits
                if (extended && ubits != 0)
                {
                    var bitSet = inst.GetTagBits(ubits);
                    for (int i = 0; i < bitSet.Capacity; i++)
                    {
                        if (bitSet.Get(i))
                        {
                            var tag = inst.GetTagForIndex(ExtendedTagBits.VANILLA_LIMIT + i);
                            if (tag != Tag.Invalid)
                            {
                                tags.Add(tag);
                            }
                        }
                    }
                }
                return(false);
            }