Changeset 20785 in vbox
- Timestamp:
- Jun 22, 2009 2:43:29 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/iprt/asm.h
r20624 r20785 5447 5447 /** 5448 5448 * Sets a bit in a bitmap. 5449 * @note Address should be 32-bit aligned for performance reasons. 5449 5450 * 5450 5451 * @param pvBitmap Pointer to the bitmap. … … 5485 5486 /** 5486 5487 * Atomically sets a bit in a bitmap, ordered. 5488 * @note Address must be 32-bit aligned, otherwise the memory access isn't atomic! 5487 5489 * 5488 5490 * @param pvBitmap Pointer to the bitmap. … … 5494 5496 DECLINLINE(void) ASMAtomicBitSet(volatile void *pvBitmap, int32_t iBit) 5495 5497 { 5498 AssertMsg(!((uintptr_t)pvBitmap & 3), ("address %p not 32-bit aligned", pvBitmap)); 5496 5499 # if RT_INLINE_ASM_USES_INTRIN 5497 5500 _interlockedbittestandset((long *)pvBitmap, iBit); … … 5522 5525 /** 5523 5526 * Clears a bit in a bitmap. 5527 * @note Address should be 32-bit aligned for performance reasons. 5524 5528 * 5525 5529 * @param pvBitmap Pointer to the bitmap. … … 5560 5564 /** 5561 5565 * Atomically clears a bit in a bitmap, ordered. 5566 * @note Address must be 32-bit aligned, otherwise the memory access isn't atomic! 5562 5567 * 5563 5568 * @param pvBitmap Pointer to the bitmap. … … 5570 5575 DECLINLINE(void) ASMAtomicBitClear(volatile void *pvBitmap, int32_t iBit) 5571 5576 { 5577 AssertMsg(!((uintptr_t)pvBitmap & 3), ("address %p not 32-bit aligned", pvBitmap)); 5572 5578 # if RT_INLINE_ASM_GNU_STYLE 5573 5579 __asm__ __volatile__("lock; btrl %1, %0" … … 5596 5602 /** 5597 5603 * Toggles a bit in a bitmap. 5604 * @note Address should be 32-bit aligned for performance reasons. 5598 5605 * 5599 5606 * @param pvBitmap Pointer to the bitmap. … … 5633 5640 /** 5634 5641 * Atomically toggles a bit in a bitmap, ordered. 5642 * @note Address must be 32-bit aligned, otherwise the memory access isn't atomic! 5635 5643 * 5636 5644 * @param pvBitmap Pointer to the bitmap. … … 5642 5650 DECLINLINE(void) ASMAtomicBitToggle(volatile void *pvBitmap, int32_t iBit) 5643 5651 { 5652 AssertMsg(!((uintptr_t)pvBitmap & 3), ("address %p not 32-bit aligned", pvBitmap)); 5644 5653 # if RT_INLINE_ASM_GNU_STYLE 5645 5654 __asm__ __volatile__("lock; btcl %1, %0" … … 5668 5677 /** 5669 5678 * Tests and sets a bit in a bitmap. 5679 * @note Address should be 32-bit aligned for performance reasons. 5670 5680 * 5671 5681 * @returns true if the bit was set. … … 5715 5725 /** 5716 5726 * Atomically tests and sets a bit in a bitmap, ordered. 5727 * @note Address must be 32-bit aligned, otherwise the memory access isn't atomic! 5717 5728 * 5718 5729 * @returns true if the bit was set. … … 5727 5738 { 5728 5739 union { bool f; uint32_t u32; uint8_t u8; } rc; 5740 AssertMsg(!((uintptr_t)pvBitmap & 3), ("address %p not 32-bit aligned", pvBitmap)); 5729 5741 # if RT_INLINE_ASM_USES_INTRIN 5730 5742 rc.u8 = _interlockedbittestandset((long *)pvBitmap, iBit); … … 5761 5773 /** 5762 5774 * Tests and clears a bit in a bitmap. 5775 * @note Address should be 32-bit aligned for performance reasons. 5763 5776 * 5764 5777 * @returns true if the bit was set. … … 5808 5821 /** 5809 5822 * Atomically tests and clears a bit in a bitmap, ordered. 5823 * @note Address must be 32-bit aligned, otherwise the memory access isn't atomic! 5810 5824 * 5811 5825 * @returns true if the bit was set. … … 5821 5835 { 5822 5836 union { bool f; uint32_t u32; uint8_t u8; } rc; 5837 AssertMsg(!((uintptr_t)pvBitmap & 3), ("address %p not 32-bit aligned", pvBitmap)); 5823 5838 # if RT_INLINE_ASM_USES_INTRIN 5824 5839 rc.u8 = _interlockedbittestandreset((long *)pvBitmap, iBit); … … 5856 5871 /** 5857 5872 * Tests and toggles a bit in a bitmap. 5873 * @note Address should be 32-bit aligned for performance reasons. 5858 5874 * 5859 5875 * @returns true if the bit was set. … … 5903 5919 /** 5904 5920 * Atomically tests and toggles a bit in a bitmap, ordered. 5921 * @note Address must be 32-bit aligned, otherwise the memory access isn't atomic! 5905 5922 * 5906 5923 * @returns true if the bit was set. … … 5915 5932 { 5916 5933 union { bool f; uint32_t u32; uint8_t u8; } rc; 5934 AssertMsg(!((uintptr_t)pvBitmap & 3), ("address %p not 32-bit aligned", pvBitmap)); 5917 5935 # if RT_INLINE_ASM_GNU_STYLE 5918 5936 __asm__ __volatile__("lock; btcl %2, %1\n\t" … … 5947 5965 /** 5948 5966 * Tests if a bit in a bitmap is set. 5967 * @note Address should be 32-bit aligned for performance reasons. 5949 5968 * 5950 5969 * @returns true if the bit is set.
Note:
See TracChangeset
for help on using the changeset viewer.