Repository: microsoft/garnet
File: libs/server/SessionParseStateExtensions.cs (C#)

Code before:

            encodingSlice = parseState.GetArgSliceByRef(idx);

            if (encodingSlice.length <= 1)
                return false;

            var ptr = encodingSlice.ptr + 1;

            return
                RespReadUtils.TryReadInt64Safe(ref ptr, encodingSlice.ptr + encodingSlice.length,
                                           out var bitCount, out var bytesRead,
                                           out _, out _, allowLeadingZeros: false) &&
                ((int)bytesRead == encodingSlice.length - 1) && (bytesRead > 0L) &&
                (bitCount > 0) &&
                ((*encodingSlice.ptr == 'i' && bitCount <= 64) ||
                 (*encodingSlice.ptr == 'u' && bitCount < 64));
        }

        /// <summary>
        /// Parse bit field OFFSET slice from parse state at specified index
        /// </summary>
        /// <param name="parseState">The parse state</param>
        /// <param name="idx">The argument index</param>
        /// <param name="offsetSlice">Parsed slice</param>
        /// <returns></returns>
        internal static unsafe bool TryGetBitfieldOffset(this SessionParseState parseState, int idx, out ArgSlice offsetSlice)
        {
            if (idx >= parseState.Count)
            {
                offsetSlice = default;
                return false;
            }

            offsetSlice = parseState.GetArgSliceByRef(idx);

            if (offsetSlice.Length <= 0)
                return false;

            var ptr = offsetSlice.ptr;
            var len = offsetSlice.length;

            if (*ptr == '#')
            {
                if (offsetSlice.length == 1)
                    return false;

                ptr++;
                len--;
            }

            return

Review comment (suggestion):
Same here, this method should be:
```cs
TryGetBitfieldOffset(this SessionParseState parseState, int idx, out long bitFieldOffset, out bool multiplyOffset)
```

Code after:
            if (encodingSlice.length <= 1)
            {
                return false;
            }

            var ptr = encodingSlice.ptr + 1;

            isSigned = *encodingSlice.ptr == 'i';

            if (!isSigned && *encodingSlice.ptr != 'u')
            {
                return false;
            }

            return
                RespReadUtils.TryReadInt64Safe(ref ptr, encodingSlice.ptr + encodingSlice.length,
                                           out bitCount, out var bytesRead,
                                           out _, out _, allowLeadingZeros: false) &&
                ((int)bytesRead == encodingSlice.length - 1) && (bytesRead > 0L) &&
                (bitCount > 0) &&
                ((isSigned && bitCount <= 64) ||
                 (!isSigned && bitCount < 64));
        }

        /// <summary>
        /// Parse bit field OFFSET slice from parse state at specified index
        /// </summary>
        /// <param name="parseState">The parse state</param>
        /// <param name="idx">The argument index</param>
        /// <param name="bitFieldOffset">parsed value</param>
        /// <param name="multiplyOffset">should value by multiplied by bitcount</param>
        /// <returns></returns>
        internal static unsafe bool TryGetBitfieldOffset(this SessionParseState parseState, int idx, out long bitFieldOffset, out bool multiplyOffset)
        {
            bitFieldOffset = default;
            multiplyOffset = default;
            var offsetSlice = parseState.GetArgSliceByRef(idx);

            if (offsetSlice.Length <= 0)
            {
                return false;
            }

            var ptr = offsetSlice.ptr;
            var len = offsetSlice.length;

            if (*ptr == '#')
            {
                if (offsetSlice.length == 1)
                    return false;