Rockbox.org home
release
dev builds
extras
themes manual
wiki
device status forums
mailing lists
IRC bugs
patches
dev guide



Rockbox mail archive

Subject: Re: Question on Config block/user_settings
From: c s (rb_dev_at_yahoo.com)
Date: 2003-04-25


--- Björn Stenberg <bjorn_at_haxx.se> wrote:
> c s wrote:
> > is the only requirement that
> > the value of a bool variable be zero OR non-zero
> (as
> > opposed to zero OR one).
>
> Yes. True and false is defined as !0 and 0. This is
> valid for all C code, not just boolean variables.
>
> > Is there an error
> > in the settings code or am I missing something?
>
> Looks good to me:
>
> Save - The caption boolean is converted to bit 1 of
> byte 0xAE:
>
> config_block[0xae] = (unsigned char)
> ((global_settings.fade_on_stop & 1) |
> ((global_settings.caption_backlight & 1) <<
> 1));
>
> Load - Bit 1 of byte 0xAE is converted to the
> caption boolean:
>
> global_settings.caption_backlight =
> config_block[0xae] & 2;
>
>

OK, I didn't realize that you could code:

  bool b = 2;

...with the result that b is equal to 1.

=====
Craig

rb_dev_at_yahoo.com

__________________________________________________
Do you Yahoo!?
The New Yahoo! Search - Faster. Easier. Bingo
http://search.yahoo.com



Page was last modified "Jan 10 2012" The Rockbox Crew
aaa