## Overview

This Module allows has functions for Bit32 like bit arithmetic and bit-packing. It is currently in its early stages of development. The link for the module is here and the update log is here.

## API

Updated API is in the replies in this thread.

#### Conversion

## SimpleBit.IntToBin()

```
SimpleBit.IntToBin(n:number): string
```

*Example:*

```
SimpleBit.IntToBin(357)
-- output: '00000000000000000000000101100101'
```

**Description:**

*Returns 32 bits of an integer in string form.*

## SimpleBit.BinToInt()

```
SimpleBit.BinToInt(BinSequence:string): number
```

*Example:*

```
SimpleBit.BinToInt('00000000000000000000000101100101')
-- output: 357
```

**Description:**

Converts a binary sequence into a bit32 number.

#### Arithmetic

## SimpleBit:Add()

```
SimpleBit.Add(a:number,b:number): number
```

*Example:*

```
SimpleBit.Add(81,57)
-- output: 138
```

**Description:**

*Adds two integers together.*

## SimpleBit:Multiply()

```
SimpleBit.Multiply(a:number,b:number): number
```

*Example:*

```
SimpleBit.Multiply(2,4)
-- output: 8
```

**Description:**

*Multiplies two integers together.*

#### BitPacking

## SimpleBit:BitPack()

```
SimpleBit:BitPack(a:number,b:number,c:number,d:number): number
```

*Example:*

```
SimpleBitBitPack(129,39,41,42)
-- output: 707340161
```

**Description:**

*Converts 4 numbers between 0 and 255 into an unsigned number that then could be converted back.

NOTE: Each number is given 1 byte, and since a byte can only hold numbers between 0 and 255, if any of the inputs were over that limit, the function would throw an error.*

## SimpleBit:BitUnpack()

```
SimpleBit:BitUnpack(n:number): tuple
```

*Example:*

```
local a, b, c, d= SimpleBit:BitUnpack(707340161)
-- output: a = 129, b = 39, c = 41,d = 42
```

**Description:**

*Converts a number from a :BitPack back into a tuple*

*Note: more API functions will be added, this is just the early stage of SimpleBit.
What are your ideas and feedback, iâ€™d love to hear them!*

*Also I recommend this tutorial if you want to know more about Bitpacking, and if you are struggling with understanding what Bit32 actually does, I recommend Robloxâ€™s Bit32 document.*