<div dir="ltr"><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Mar 27, 2019 at 7:48 PM Christo Crause <<a href="mailto:christo.crause@gmail.com">christo.crause@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="auto"><div><br><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, 27 Mar 2019, 19:27 DJ Coertzen, <<a href="mailto:patrolliekaptein@gmail.com" target="_blank">patrolliekaptein@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div dir="ltr"><div>Hi there,</div><div><br></div><div>I need a solution for a packed record containing 4-byte 32-bit integers and cardinals, and other byte 8 bit and word 16 bit sized variables to overlay over a stream.</div><div><br></div><div>Example:</div><div><span style="color:rgb(0,0,255)"><b><span style="font-family:monospace,monospace">type</span></b></span></div><div><span style="color:rgb(0,0,255)"><b><span style="font-family:monospace,monospace"> TMyBinaryHeader = packed record</span></b></span></div><div><span style="color:rgb(0,0,255)"><b><span style="font-family:monospace,monospace"> Sender : Cardinal;</span></b></span></div><div><span style="color:rgb(0,0,255)"><b><span style="font-family:monospace,monospace"> Target : Cardinal;<br></span></b></span></div><div><span style="color:rgb(0,0,255)"><b><span style="font-family:monospace,monospace"> Reference : Integer; <br></span></b></span></div><div><span style="color:rgb(0,0,255)"><b><span style="font-family:monospace,monospace"> Flags : Word;<br></span></b></span></div><div><span style="color:rgb(0,0,255)"><b><span style="font-family:monospace,monospace"> <span style="color:rgb(0,0,255)"><b><span style="font-family:monospace,monospace">CheckByte : Byte;</span></b></span></span></b></span></div><div><span style="color:rgb(0,0,255)"><b><span style="font-family:monospace,monospace"> end;</span></b></span></div><div><br></div><div>So on 32 bit systems, SizeOf(TMyBinaryHeader) will report 15 bytes. How do I accomplish this on 64 bit platform and avoiding "myprotocollib.pas(x,y) Error: Typecast has different size (4 -> 8) in assignment" without having to port to ugly byte copy operations.</div></div></div></blockquote></div></div><div dir="auto"><br></div><div dir="auto">Perhaps use size explicit types such as uint32 and int32? </div></div>
_______________________________________________<br>
fpc-devel maillist - <a href="mailto:fpc-devel@lists.freepascal.org" target="_blank">fpc-devel@lists.freepascal.org</a><br>
<a href="http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel" rel="noreferrer" target="_blank">http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel</a></blockquote><div><br></div><div>I discovered UInt32 in the meanwhile . Thanks. I replied on the wrong response about pointer arithmetic</div><div><br></div></div></div>