Hi Armin
No. Expected result still &H40.
Unfortunately, I cannot easily change the byte order as these are sent to me
from an external source, as binary coded hex digits.
Charles
"Armin Zingler" <(E-Mail Removed)> wrote in message
news:40bc7db4$0$24800$(E-Mail Removed)...
> "Charles Law" <(E-Mail Removed)> schrieb
> > > > Given the following
> > > >
> > > > <code>
> > > > Dim ba(1) As Byte
> > > > Dim b As Byte
> > > >
> > > > ba(0) = &h4
> > > > ba(1) = &h0
> > > >
> > > > b = foo(ba)
> > > > </code>
> > > >
> > > > What is foo() such that b contains &h40 ?
> > >
> > > What if ba(0) or ba(1) > &Hf?
> > >
> > > If both are [0; &HF]:
> > >
> > > b = ba(0) << 4 or ba(1)
> >
> > Sorry for the confusion, but I think my correction is a bit slow
> > coming through. I should have written
> >
> > ba(0) = &h34
> > ba(1) = &h30
>
> Expected result? &H3430?
>
> Dim ba(1) As Byte
> Dim s As Short
>
> ba(0) = &H34
> ba(1) = &H30
>
> s = CShort(ba(0)) << 8 Or ba(1)
>
>
> If you can exchange the byte order, this is also possible:
>
> s = System.BitConverter.ToInt16(ba, 0)
>
>
>
> --
> Armin
>
> How to quote and why:
> http://www.plig.net/nnq/nquote.html
> http://www.netmeister.org/news/learn2quote.html
>