On 03/07/2017 07:06 PM, Eric Brown wrote:
> By the way, this is code snipped from within a conditional check, so
> memoryBlock[2] will always be < 187 in this situation.
>
> On Tuesday, March 7, 2017 at 6:02:59 PM UTC-6, Eric Brown wrote:
>
> memoryBlock := make([]byte, 4)
> binary.LittleEndian.PutUint32(memoryBlock, 12345678)
>
> memoryBlock[2] = 256 - (187 - memoryBlock[2]) ' results in error:
> constant 256 overflows byte
> memoryBlock[2] = 255 - (187 - memoryBlock[2]) + 1 ' results in no
> errors
>
Sorry, I only needed to cast the variable:
memoryBlock[2] = byte(256 - (187 - int(memoryBlock[2])))