Go to Post For guys, is the appropriate term "manpris". ? - Chris Fultz [more]
Home
Go Back   Chief Delphi > Technical > Programming > C/C++
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Spotlight this post!  
Unread 21-06-2009, 19:59
byteit101's Avatar
byteit101 byteit101 is offline
WPILib maintainer (WPI)
AKA: Patrick Plenefisch
no team (The Cat Attack (Formerly))
Team Role: Programmer
 
Join Date: Jan 2009
Rookie Year: 2009
Location: Worcester
Posts: 699
byteit101 is a glorious beacon of lightbyteit101 is a glorious beacon of lightbyteit101 is a glorious beacon of lightbyteit101 is a glorious beacon of lightbyteit101 is a glorious beacon of lightbyteit101 is a glorious beacon of light
PPC bool bitfield

I was working on a library to make some tasks easier on the cRIO, and the library contained a bitfield that looks like this:
Code:
union ORArgs
{
	unsigned char Value;
	struct b
	{
		bool b0 : 1,
		b1 : 1, 
		b2 : 1, 
		b3 : 1, 
		b4 : 1, 
		b5 : 1, 
		b6 : 1, 
		b7 : 1;
	} Bits;
};
later, I read that bools are 4 bytes on a PPC system, which we have in the crio, and was wondering if the four bytes would cause undesired effects, like set b0,b1,b2, and b3 to true if b1 is set to true, but after thinking about it for a while, I thought that the first bit of bool b0 would equal the first bit of char Value, and the rest of the bits would be "discarded". unfortunately, I won't have access to the cRIO for another week. Is my first thought or second thought the true one?
__________________
Bubble Wrap: programmers rewards
Watchdog.Kill();
printf("Watchdog is Dead, Celebrate!");
How to make a self aware robot: while (∞) cout<<(sqrt(-∞)/-0);
Previously FRC 451 (The Cat Attack)
Now part of the class of 2016 at WPI & helping on WPILib
Reply With Quote
 


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
PPC 970FX Beats P4 and AMD64 Joe Matt Chit-Chat 4 14-02-2004 14:52
bool Variables, Autonomous Mode lasindi Programming 6 22-01-2004 22:26


All times are GMT -5. The time now is 13:36.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi