Hi...

The :5 represents bit0 to bit 4  (5 bits) of a BYTE
                -> this it is a value represented by 5 bits
The :1 then represents the 6the bit of the byte

So then the last 2 bits of the byte are unused


Regards
Ray

-----Original Message-----
From: [email protected] [mailto:[email protected]]
On Behalf Of James Brown
Sent: Wednesday, 2 September 2009 11:27 a.m.
To: Delphi-Talk Discussion List
Subject: Re: Variant Records

I'm even noobier but I think that the :5, :1 are presetting the structure,
like defaults.

--------------------------------------------------
From: "John Clements" <[email protected]>
Sent: Tuesday, September 01, 2009 2:41 PM
To: "Delphi-Talk Discussion List" <[email protected]>
Subject: RE: Variant Records

> I am a C noob so am unsure what the :5, :1 are, but assuming they are 
> arrays the structure would look something like this I imagine:
>
>  USBDeviceRequest = packed record
>    bmRequestType : Byte;
>    case Bits : Byte of
>      0 : (Recipient : array [1..5] of Byte);
>      1 : (DataDirection : array [1..1] of Byte);  end; { 
> USBDeviceRequest }
>
>
> -----Original Message-----
> From: [email protected]
> [mailto:[email protected]] On Behalf Of James Brown
> Sent: Tuesday, September 01, 2009 3:46 PM
> To: [email protected]
> Subject: Variant Records
>
> I cannot figure out what the equivalent Delphi for this C struct would
> be:
> typedef struct _USB_DEVICE_REQUEST
> {
>    union
>    {
>        BYTE  bmRequestType;
>        struct
>        {
>            BYTE Recipient:5;
>            BYTE DataDirection:1;
>       }
>        Bits;
> };
>
> I know it's a type of free union variant but what the heck is it.
>
> Thanks........ Jim
> __________________________________________________
> Delphi-Talk mailing list -> [email protected] 
> http://lists.elists.org/cgi-bin/mailman/listinfo/delphi-talk
> __________________________________________________
> Delphi-Talk mailing list -> [email protected] 
> http://lists.elists.org/cgi-bin/mailman/listinfo/delphi-talk
> 
__________________________________________________
Delphi-Talk mailing list -> [email protected]
http://lists.elists.org/cgi-bin/mailman/listinfo/delphi-talk
No virus found in this incoming message.
Checked by AVG - www.avg.com
Version: 8.5.409 / Virus Database: 270.13.73/2338 - Release Date: 09/01/09
06:52:00

__________________________________________________
Delphi-Talk mailing list -> [email protected]
http://lists.elists.org/cgi-bin/mailman/listinfo/delphi-talk

Reply via email to