POV-Ray : Newsgroups : povray.off-topic : Programming langauges : Re: Programming langauges Server Time
5 Sep 2024 09:23:09 EDT (-0400)
  Re: Programming langauges  
From: Captain Jack
Date: 22 Oct 2009 16:35:31
Message: <4ae0c213$1@news.povray.org>
"Orchid XP v8" <voi### [at] devnull> wrote in message 
news:4ae0be3d$1@news.povray.org...
> I mean, sure, it has support for twiddling bits and stuff. But you'd think 
> if you were doing low-level work, you would have a way to explicitly say 
> how many bits you want to use. Yet C provides no such facility.

Wouldn't bit fields do what you're describing? As in:

struct PackBits {
    unsigned int field1:2;
    unsigned int field2:1;
    unsigned int field3:4;
    unsigned int field4:1;
}

I can't recall if that's in K&R, but I'm sure it's at least ANSI C.


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.