~n-muench/ubuntu/oneiric/open-vm-tools/open-vm-tools.fix-836277

« back to all changes in this revision

Viewing changes to lib/include/vm_basic_asm.h

  • Committer: Bazaar Package Importer
  • Author(s): Daniel Baumann
  • Date: 2008-10-23 15:32:00 UTC
  • mfrom: (1.1.2 upstream) (2.1.2 sid)
  • Revision ID: james.westby@ubuntu.com-20081023153200-gc1bfx89hj35c799
Tags: 2008.10.10-123053-2
* Correcting typo in dh_installinit call.
* Downgrading depends on module-assistant to recommends.

Show diffs side-by-side

added added

removed removed

Lines of Context:
722
722
/*
723
723
 *-----------------------------------------------------------------------------
724
724
 *
725
 
 * Bswap --
 
725
 * Bswap32 --
726
726
 *
727
 
 *    Swap the 4 bytes of "v" as follows: 3210 -> 0123.
 
727
 *      Swap the 4 bytes of "v" as follows: 3210 -> 0123.
728
728
 *
729
729
 *-----------------------------------------------------------------------------
730
730
 */
731
731
 
732
 
#ifdef __GNUC__ // {
733
732
static INLINE uint32
734
 
Bswap(uint32 v)
 
733
Bswap32(uint32 v) // IN
735
734
{
736
 
   /* Checked against the Intel manual and GCC --hpreg */
 
735
#ifdef __GNUC__ // {
 
736
   /* Checked against the Intel manual and GCC. --hpreg */
737
737
   __asm__(
738
 
      "bswap %0" 
 
738
      "bswap %0"
739
739
      : "=r" (v)
740
740
      : "0" (v)
741
741
   );
742
742
   return v;
743
 
}
 
743
#else // } {
 
744
   return    (v >> 24)
 
745
          | ((v >>  8) & 0xFF00)
 
746
          | ((v & 0xFF00) <<  8)
 
747
          |  (v << 24)          ;
744
748
#endif // }
 
749
}
 
750
#define Bswap Bswap32
 
751
 
 
752
 
 
753
/*
 
754
 *-----------------------------------------------------------------------------
 
755
 *
 
756
 * Bswap64 --
 
757
 *
 
758
 *      Swap the 8 bytes of "v" as follows: 76543210 -> 01234567.
 
759
 *
 
760
 *-----------------------------------------------------------------------------
 
761
 */
 
762
 
 
763
static INLINE uint64
 
764
Bswap64(uint64 v) // IN
 
765
{
 
766
   return ((uint64)Bswap((uint32)v) << 32) | Bswap((uint32)(v >> 32));
 
767
}
 
768
 
745
769
 
746
770
#ifdef __GNUC__ // {
747
771
/*