~ubuntu-branches/debian/sid/upx-ucl/sid

« back to all changes in this revision

Viewing changes to src/bele.h

  • Committer: Bazaar Package Importer
  • Author(s): Robert Luberda
  • Date: 2009-10-16 12:56:47 UTC
  • mfrom: (1.2.8 upstream)
  • Revision ID: james.westby@ubuntu.com-20091016125647-vity1npel2qsmr9c
Tags: 3.04-1
* New upstream release:
  + FTBFS with gcc 4.4 fixed by upstream (closes: #548566).
* p_mach.cpp: Fix from upstream vcs: mach/fat needs seek() 
  after set_extent().

Show diffs side-by-side

added added

removed removed

Lines of Context:
2
2
 
3
3
   This file is part of the UPX executable compressor.
4
4
 
5
 
   Copyright (C) 1996-2008 Markus Franz Xaver Johannes Oberhumer
6
 
   Copyright (C) 1996-2008 Laszlo Molnar
 
5
   Copyright (C) 1996-2009 Markus Franz Xaver Johannes Oberhumer
 
6
   Copyright (C) 1996-2009 Laszlo Molnar
7
7
   All Rights Reserved.
8
8
 
9
9
   UPX and the UCL library are free software; you can redistribute them
282
282
 
283
283
inline void acc_swab16s(acc_uint16e_t *p)
284
284
{
285
 
    *p = acc_swab16(*p);
 
285
    *p = (acc_uint16e_t) acc_swab16(*p);
286
286
}
287
287
 
288
288
inline void acc_swab32s(acc_uint32e_t *p)
289
289
{
290
 
    *p = acc_swab32(*p);
 
290
    *p = (acc_uint32e_t) acc_swab32(*p);
291
291
}
292
292
 
293
293
 
313
313
//  to have gcc bug 17519 fixed - see http://gcc.gnu.org/PR17519 ]
314
314
**************************************************************************/
315
315
 
316
 
struct BE16
317
 
{
 
316
__packed_struct(BE16)
318
317
    unsigned char d[2];
319
318
 
320
319
    //inline BE16() { }
332
331
    BE16& operator >>= (unsigned v) { set_be16(d, get_be16(d) >> v); return *this; }
333
332
 
334
333
    operator unsigned () const  { return get_be16(d); }
335
 
}
336
 
__attribute_packed;
337
 
 
338
 
 
339
 
struct BE32
340
 
{
 
334
__packed_struct_end()
 
335
 
 
336
 
 
337
__packed_struct(BE32)
341
338
    unsigned char d[4];
342
339
 
343
340
    //inline BE32() { }
355
352
    BE32& operator >>= (unsigned v) { set_be32(d, get_be32(d) >> v); return *this; }
356
353
 
357
354
    operator unsigned () const  { return get_be32(d); }
358
 
}
359
 
__attribute_packed;
360
 
 
361
 
 
362
 
struct BE64
363
 
{
 
355
__packed_struct_end()
 
356
 
 
357
 
 
358
__packed_struct(BE64)
364
359
    unsigned char d[8];
365
360
 
366
361
    //inline BE64() { }
378
373
    BE64& operator >>= (unsigned v) { set_be64(d, get_be64(d) >> v); return *this; }
379
374
 
380
375
    operator acc_uint64l_t () const  { return get_be64(d); }
381
 
}
382
 
__attribute_packed;
383
 
 
384
 
 
385
 
struct LE16
386
 
{
 
376
__packed_struct_end()
 
377
 
 
378
 
 
379
__packed_struct(LE16)
387
380
    unsigned char d[2];
388
381
 
389
382
    //inline LE16() { }
401
394
    LE16& operator >>= (unsigned v) { set_le16(d, get_le16(d) >> v); return *this; }
402
395
 
403
396
    operator unsigned () const  { return get_le16(d); }
404
 
}
405
 
__attribute_packed;
406
 
 
407
 
 
408
 
struct LE32
409
 
{
 
397
__packed_struct_end()
 
398
 
 
399
 
 
400
__packed_struct(LE32)
410
401
    unsigned char d[4];
411
402
 
412
403
    //inline LE32() { }
424
415
    LE32& operator >>= (unsigned v) { set_le32(d, get_le32(d) >> v); return *this; }
425
416
 
426
417
    operator unsigned () const  { return get_le32(d); }
427
 
}
428
 
__attribute_packed;
429
 
 
430
 
 
431
 
struct LE64
432
 
{
 
418
__packed_struct_end()
 
419
 
 
420
 
 
421
__packed_struct(LE64)
433
422
    unsigned char d[8];
434
423
 
435
424
    //inline LE64() { }
447
436
    LE64& operator >>= (unsigned v) { set_le64(d, get_le64(d) >> v); return *this; }
448
437
 
449
438
    operator acc_uint64l_t () const  { return get_le64(d); }
450
 
}
451
 
__attribute_packed;
 
439
__packed_struct_end()
452
440
 
453
441
 
454
442
/*************************************************************************
623
611
}
624
612
 
625
613
namespace N_BELE_CTP {
626
 
 
627
 
template <class T>
628
 
inline const N_BELE_RTP::AbstractPolicy* getRTP();
629
 
template <>
630
 
inline const N_BELE_RTP::AbstractPolicy* getRTP<BEPolicy>()
631
 
     { return &N_BELE_RTP::be_policy; }
632
 
template <>
633
 
inline const N_BELE_RTP::AbstractPolicy* getRTP<LEPolicy>()
634
 
     { return &N_BELE_RTP::le_policy; }
635
 
 
 
614
inline const N_BELE_RTP::AbstractPolicy* getRTP(const BEPolicy*)
 
615
    { return &N_BELE_RTP::be_policy; }
 
616
inline const N_BELE_RTP::AbstractPolicy* getRTP(const LEPolicy*)
 
617
    { return &N_BELE_RTP::le_policy; }
636
618
}
637
619
 
638
620