/[jscoverage]/trunk/js/jsbit.h
ViewVC logotype

Diff of /trunk/js/jsbit.h

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 460 by siliconforks, Sat Sep 26 23:15:22 2009 UTC revision 507 by siliconforks, Sun Jan 10 07:23:34 2010 UTC
# Line 78  Line 78 
78   *   *
79   * SWS: Added MSVC intrinsic bitscan support.  See bugs 349364 and 356856.   * SWS: Added MSVC intrinsic bitscan support.  See bugs 349364 and 356856.
80   */   */
81  #if defined(_WIN32) && (_MSC_VER >= 1300) && defined(_M_IX86)  #if defined(_WIN32) && (_MSC_VER >= 1300) && (defined(_M_IX86) || defined(_M_AMD64) || defined(_M_X64))
82    
83  unsigned char _BitScanForward(unsigned long * Index, unsigned long Mask);  unsigned char _BitScanForward(unsigned long * Index, unsigned long Mask);
84  unsigned char _BitScanReverse(unsigned long * Index, unsigned long Mask);  unsigned char _BitScanReverse(unsigned long * Index, unsigned long Mask);
# Line 104  Line 104 
104  # define js_bitscan_clz32(val)  __BitScanReverse32(val)  # define js_bitscan_clz32(val)  __BitScanReverse32(val)
105  # define JS_HAS_BUILTIN_BITSCAN32  # define JS_HAS_BUILTIN_BITSCAN32
106    
107    #if defined(_M_AMD64) || defined(_M_X64)
108    unsigned char _BitScanForward64(unsigned long * Index, unsigned __int64 Mask);
109    unsigned char _BitScanReverse64(unsigned long * Index, unsigned __int64 Mask);
110    # pragma intrinsic(_BitScanForward64,_BitScanReverse64)
111    
112    __forceinline static int
113    __BitScanForward64(unsigned __int64 val)
114    {
115        unsigned long idx;
116    
117        _BitScanForward64(&idx, val);
118        return (int)idx;
119    }
120    __forceinline static int
121    __BitScanReverse64(unsigned __int64 val)
122    {
123        unsigned long idx;
124    
125        _BitScanReverse64(&idx, val);
126        return (int)(63-idx);
127    }
128    # define js_bitscan_ctz64(val)  __BitScanForward64(val)
129    # define js_bitscan_clz64(val)  __BitScanReverse64(val)
130    # define JS_HAS_BUILTIN_BITSCAN64
131    #endif
132  #elif (__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)  #elif (__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)
133    
134  # define js_bitscan_ctz32(val)  __builtin_ctz(val)  # define js_bitscan_ctz32(val)  __builtin_ctz(val)

Legend:
Removed from v.460  
changed lines
  Added in v.507

  ViewVC Help
Powered by ViewVC 1.1.24