<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://community.arm.com/utility/feedstylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Can memcpy() use in this way?</title><link>https://community.arm.com/developer/tools-software/tools/f/keil-forum/17714/can-memcpy-use-in-this-way</link><description> When needed read one unsigned long type variable from uart_buffer, the code following is false,how correct it? 
 
like: 
... 
#include&amp;lt;string.h&amp;gt; 
uchar x[2408]={0x12,0x34,0x56,0x78,...}; 
unsigned long lTemp=0; 
unsigned int iDay = 2; 
... 
 memcpy(&amp;amp;lTemp</description><dc:language>en-US</dc:language><generator>Telligent Community 10</generator><item><title>RE: Can memcpy() use in this way?</title><link>https://community.arm.com/thread/87145?ContentTypeID=1</link><pubDate>Thu, 24 Mar 2005 11:09:24 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:77990aef-aed2-4b16-a2e9-24a1ffd07ef0</guid><dc:creator>Drew Davis</dc:creator><description>&lt;p&gt;You have an endianess mismatch somewhere in your system.  The 8051, since it&amp;#39;s an 8-bit processor, has no endianness to worry about.  Keil C stores multi-byte integers in big endian format, most significant byte first.&lt;br /&gt;
&lt;br /&gt;
You&amp;#39;ll need to write a function (or macro) that byte-swaps the data in your input buffer to match the local representation.&lt;br /&gt;
&lt;br /&gt;
You might be able to do a swap in place, if you don&amp;#39;t mind altering your input value.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Can memcpy() use in this way?</title><link>https://community.arm.com/thread/43756?ContentTypeID=1</link><pubDate>Thu, 24 Mar 2005 11:07:18 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:4bb77ab7-af40-4cbb-b0b2-8d0fff422d7c</guid><dc:creator>Karl Hamsher</dc:creator><description>&lt;p&gt;&lt;i&gt;Can memcpy() use in this way?&lt;/i&gt;&lt;br /&gt;
&lt;br /&gt;
C51 implements a big-endian model, so memcpy() can be used that way only when the data in uart_buffer is also big-endian.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Can memcpy() use in this way?</title><link>https://community.arm.com/thread/43755?ContentTypeID=1</link><pubDate>Thu, 24 Mar 2005 10:20:19 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:bce84f1b-584c-4dd3-8b37-b2fda98e3f8a</guid><dc:creator>Nantian Gumo</dc:creator><description>&lt;p&gt;Correct: iDay = 3;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>