>From: "Pavol Droba" <[EMAIL PROTECTED]>
> On Mon, Nov 25, 2002 at 04:52:35PM +0100, Terje Sletteb? wrote:
> > >From: "Pavol Droba" <[EMAIL PROTECTED]>
> >
> > > I can imagine it should be something like this:
> > >
> > > void modify_binary_header( void* pData )
> > > {
> > > binary_struct b;
> >
On Mon, Nov 25, 2002 at 04:52:35PM +0100, Terje Sletteb? wrote:
> >From: "Pavol Droba" <[EMAIL PROTECTED]>
>
> > On Mon, Nov 25, 2002 at 02:47:54PM +0100, Terje Sletteb? wrote:
> >
> > > How did you do it on the ARM? As I understand, it requires
> > > word-alignment
> > > for words (and half-word
>From: "Pavol Droba" <[EMAIL PROTECTED]>
> On Mon, Nov 25, 2002 at 02:47:54PM +0100, Terje Sletteb? wrote:
>
> > How did you do it on the ARM? As I understand, it requires
word-alignment
> > for words (and half-word alignment for half-words, if that is supported
on
> > the given ARM version).
> >
On Mon, Nov 25, 2002 at 02:47:54PM +0100, Terje Sletteb? wrote:
[snip]
> As you say, and as was pointed out at the start of the thread, it may work
> on a specific platform (like x86). Perhaps it could be possible to have code
> that detects the platform, and which could then report an error on
>
>From: "Pavol Droba" <[EMAIL PROTECTED]>
> > > On Sun, Nov 24, 2002 at 07:27:42PM +0100, Terje Sletteb? wrote:
> >
> > For example, if you have a buffer like this (starting at an aligned
> > address):
> >
> > +0 - One byte
> > +1 - Number 1
> > +5 - Number 2
> > +9 - Number 3
> >
> > Even if you h
On Sun, Nov 24, 2002 at 11:18:10PM +0100, Terje Sletteb? wrote:
> > On Sun, Nov 24, 2002 at 07:27:42PM +0100, Terje Sletteb? wrote:
> > > >From: "Pavol Droba" <[EMAIL PROTECTED]>
> > > >
> > > > Reinterpret-cast could be avoided like this:
> > > >
> > > > template< typename T >
> > > > inline T* of
> On Sun, Nov 24, 2002 at 07:27:42PM +0100, Terje Sletteb? wrote:
> > >From: "Pavol Droba" <[EMAIL PROTECTED]>
> > >
> > > Reinterpret-cast could be avoided like this:
> > >
> > > template< typename T >
> > > inline T* offset_cast( void* p, unsigned int offset=0 )
> > > {
> > > return static_cas
On Sun, Nov 24, 2002 at 07:27:42PM +0100, Terje Sletteb? wrote:
> >From: "Pavol Droba" <[EMAIL PROTECTED]>
> >
> > The prerequisite I haven't mentioned is that if you wan to use a structure
> to
> > map to such a buffer, it has to have 1 byte aligmnent. Most of the
> compilers
> > allow this kind o
>From: "Pavol Droba" <[EMAIL PROTECTED]>
Sorry for sending this as several mails.
> template< typename T >
> inline T offset_cast( void* p, unsigned int offset=0 )
> {
> return reinterpret_cast< T >( static_cast( p )+offset );
> }
There is also the issue of the interface. This "cast", unlike th
>From: "Pavol Droba" <[EMAIL PROTECTED]>
>
> The prerequisite I haven't mentioned is that if you wan to use a structure
to
> map to such a buffer, it has to have 1 byte aligmnent. Most of the
compilers
> allow this kind of specification with pragmas.
>
> Reinterpret-cast could be avoided like this:
On Sun, Nov 24, 2002 at 04:59:45PM +0100, Terje Sletteb? wrote:
> >From: "Pavol Droba" <[EMAIL PROTECTED]>
>
> > On Sun, Nov 24, 2002 at 01:26:05PM +0100, Terje Sletteb? wrote:
> > > >From: "Pavol Droba" <[EMAIL PROTECTED]>
> > >
> > > > I have developed a simple cast function which I found very u
>From: "Pavol Droba" <[EMAIL PROTECTED]>
> On Sun, Nov 24, 2002 at 01:26:05PM +0100, Terje Sletteb? wrote:
> > >From: "Pavol Droba" <[EMAIL PROTECTED]>
> >
> > > I have developed a simple cast function which I found very useful.
Here it
> > is:
> > >
> > > template< typename T >
> > > inline T off
On Sun, Nov 24, 2002 at 01:26:05PM +0100, Terje Sletteb? wrote:
> >From: "Pavol Droba" <[EMAIL PROTECTED]>
>
> > I have developed a simple cast function which I found very useful. Here it
> is:
> >
> > template< typename T >
> > inline T offset_cast( void* p, unsigned int offset=0 )
> > {
> > ret
Pavol Droba <[EMAIL PROTECTED]> writes:
> Hi,
>
> I have developed a simple cast function which I found very useful. Here it is:
>
> template< typename T >
> inline T offset_cast( void* p, unsigned int offset=0 )
> {
> return reinterpret_cast< T >( static_cast( p )
>From: "Pavol Droba" <[EMAIL PROTECTED]>
> I have developed a simple cast function which I found very useful. Here it
is:
>
> template< typename T >
> inline T offset_cast( void* p, unsigned int offset=0 )
> {
> return reinterpret_cast< T >( static_cast( p )+offset );
> }
>
> template< typename T
Hi,
I have developed a simple cast function which I found very useful. Here it is:
template< typename T >
inline T offset_cast( void* p, unsigned int offset=0 )
{
return reinterpret_cast< T >( static_cast( p )+offset
);
}
templat
16 matches
Mail list logo