Home convert 2 bytes into small integer
Reply: 0

convert 2 bytes into small integer

user372
1#
user372 Published in April 26, 2018, 5:13 pm

I need to generate a small integer data type out of 2 bytes, my code fails with result = 0

function BytestoSmallInt(B0, B1: Byte): SmallInt;
var
  Number: SmallInt;
  pointer : ^SmallInt;
  small: array [0 .. 1] of Byte absolute Number;
begin
  pointer := @Number;
  small[0] := B1;
  small[1] := B0;
  Result := pointer^;
end;
You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.312881 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO