Advertisement
Guest User

Untitled

a guest
Jun 19th, 2019
127
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Nim 0.28 KB | None | 0 0
  1. type
  2.   MQTTByte = uint8
  3.  
  4. proc MQTTByte(x: uint8): MQTTByte =
  5.   result = MQTTByte()
  6.   result.cont = x and 1 #Extract continue bit
  7.   result.bit =  x and uint8.high - 1 #Get data bits
  8.  
  9. ...
  10. var varValue = 276
  11. varValue = (varValue / 128).uint8.MQTTByte #redefinition of 'MQTTByte';
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement