Jump to content

Float Lib Bug


Recommended Posts

Hi

 

It seems that code like:

 

float foo;

float bar[2];

 

foo = bar[1];

 

does not correctly copy values. You can work round this using

 

memcpy((void*)&foo, (void*)&bar[1], 4)

 

 

Neil

 

OS XPpro, BoostC++ 6.90 PIC18f8722

Edited by Neil
Link to post
Share on other sites

Don't get too upset Neil, I talk to anyone ;)

 

	foo = bar[1];
005E  5005		  MOVF gbl_bar+D'4', W
0060  6E09		  MOVWF gbl_foo
0062  5006		  MOVF gbl_bar+D'5', W
0064  6E0A		  MOVWF gbl_foo+D'1'
0066  5007		  MOVF gbl_bar+D'6', W
0068  6E0B		  MOVWF gbl_foo+D'2'
006A  5008		  MOVF gbl_bar+D'7', W
006C  6E0C		  MOVWF gbl_foo+D'3'

 

The assembler code appear to copy the 4 bytes.

 

Cheers

 

Reynard

Link to post
Share on other sites

Join the conversation

You are posting as a guest. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...