# ParagonIE_Sodium_Core_Base64_UrlSafe::decode6Bits

## #Summery Summery

Uses bitwise operators instead of table-lookups to turn 6-bit integers into 8-bit integers.

## #Syntax Syntax

ParagonIE_Sodium_Core_Base64_UrlSafe::decode6Bits( int \$src )

## #Description Description

Base64 character set: [A-Z] [a-z] [0-9] + / 0x41-0x5a, 0x61-0x7a, 0x30-0x39, 0x2b, 0x2f

\$src

(Required)

(int)

## #Source Source

```    protected static function decode6Bits(\$src)
{
\$ret = -1;

// if (\$src > 0x40 && \$src < 0x5b) \$ret += \$src - 0x41 + 1; // -64
\$ret += (((0x40 - \$src) & (\$src - 0x5b)) >> 8) & (\$src - 64);

// if (\$src > 0x60 && \$src < 0x7b) \$ret += \$src - 0x61 + 26 + 1; // -70
\$ret += (((0x60 - \$src) & (\$src - 0x7b)) >> 8) & (\$src - 70);

// if (\$src > 0x2f && \$src < 0x3a) \$ret += \$src - 0x30 + 52 + 1; // 5
\$ret += (((0x2f - \$src) & (\$src - 0x3a)) >> 8) & (\$src + 5);

// if (\$src == 0x2c) \$ret += 62 + 1;
\$ret += (((0x2c - \$src) & (\$src - 0x2e)) >> 8) & 63;

// if (\$src == 0x5f) ret += 63 + 1;
\$ret += (((0x5e - \$src) & (\$src - 0x60)) >> 8) & 64;

return \$ret;
}
```