[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Using unsigned shorts
- From: Rob Kendrick <rjek@...>
- Date: Wed, 21 Nov 2012 17:18:19 +0000
On Wed, Nov 21, 2012 at 07:03:36PM +0200, steve donovan wrote:
> On Wed, Nov 21, 2012 at 4:49 PM, <mchalkley@mail.com> wrote:
> > I have to send and receive UDP packets containing unsigned shorts, for
> > a diagnostic tool I'm writing.
>
> How about Roberto's struct library?
I would have thought that if you have a string 's' containing the two
bytes of the short, this is just fine:
x = (string.byte(s, 1) * 256) + string.byte(s, 2)
B.