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

Code before:
        /// <summary>
        /// Processes ACL GENPASS subcommand.
        /// </summary>
        /// <returns>true if parsing succeeded correctly, false if not all tokens could be consumed and further processing is necessary.</returns>
        private bool NetworkAclGenPass()
        {
            if (parseState.Count > 1)
            {
                return AbortWithWrongNumberOfArguments("acl|genpass");
            }

            // Default length
            var length = 64;
            if (parseState.Count == 1)
            {
                if (!parseState.TryGetLong(0, out var chars))
                {
                    return AbortWithErrorMessage(CmdStrings.RESP_ERR_GENERIC_VALUE_IS_NOT_INTEGER);
                }

                if ((chars <= 0) || (chars > 4096))
                {
                    return AbortWithErrorMessage("ERR ACL GENPASS argument must be the number of bits for the output password, a positive number up to 4096"u8);
                }

                length = (chars % 4 == 0) ? (int)chars / 4 : (int)chars / 4 + 1;
            }

            WriteAsciiBulkString(System.Security.Cryptography.RandomNumberGenerator.GetHexString(length, true));
            return true;
        }

        /// <summary>
        /// Processes ACL GETUSER subcommand.
        /// </summary>
        /// <returns>true if parsing succeeded correctly, false if not all tokens could be consumed and further processing is necessary.</returns>
        private bool NetworkAclGetUser()
        {
            // The username must be provided.
            if (parseState.Count != 1)
            {
                return AbortWithWrongNumberOfArguments("acl|getuser");
            }

            if (!ValidateACLAuthenticator())
                return true;

            var aclAuthenticator = (GarnetACLAuthenticator)_authenticator;
            User user = null;

            try

Review comment (suggestion):
Might be a bit clearer: ```length = (int)(chars / 4) + (chars % 4 == 0 ? 0 : 1);```

Code after:
        /// <summary>
        /// Processes ACL GENPASS subcommand.
        /// </summary>
        /// <returns>true if parsing succeeded correctly, false if not all tokens could be consumed and further processing is necessary.</returns>
        private bool NetworkAclGenPass()
        {
            if (parseState.Count > 1)
            {
                return AbortWithWrongNumberOfArguments("acl|genpass");
            }

            // Default length
            var length = 64;
            if (parseState.Count == 1)
            {
                if (!parseState.TryGetLong(0, out var bits))
                {
                    return AbortWithErrorMessage(CmdStrings.RESP_ERR_GENERIC_VALUE_IS_NOT_INTEGER);
                }

                if ((bits <= 0) || (bits > 4096))
                {
                    return AbortWithErrorMessage("ERR ACL GENPASS argument must be the number of bits for the output password, a positive number up to 4096"u8);
                }

                // Bits gets rounded to the next multiple of 4 and converted to bytes to get the password length
                length = (int)(bits / 4) + (bits % 4 == 0 ? 0 : 1);
            }

            WriteAsciiBulkString(System.Security.Cryptography.RandomNumberGenerator.GetHexString(length, true));
            return true;
        }

        /// <summary>
        /// Processes ACL GETUSER subcommand.
        /// </summary>
        /// <returns>true if parsing succeeded correctly, false if not all tokens could be consumed and further processing is necessary.</returns>
        private bool NetworkAclGetUser()
        {
            // The username must be provided.
            if (parseState.Count != 1)
            {
                return AbortWithWrongNumberOfArguments("acl|getuser");
            }

            if (!ValidateACLAuthenticator())
                return true;

            var aclAuthenticator = (GarnetACLAuthenticator)_authenticator;
            User user = null;