Changeset 58459 in vbox for trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/BaseLib/BitField.c
- Timestamp:
- Oct 28, 2015 8:17:18 PM (9 years ago)
- Location:
- trunk/src/VBox/Devices/EFI/Firmware
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/EFI/Firmware
-
Property svn:mergeinfo
set to (toggle deleted branches)
/vendor/edk2/current 103735-103757
-
Property svn:mergeinfo
set to (toggle deleted branches)
-
trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/BaseLib/BitField.c
r48674 r58459 2 2 Bit field functions of BaseLib. 3 3 4 Copyright (c) 2006 - 201 0, Intel Corporation. All rights reserved.<BR>4 Copyright (c) 2006 - 2013, Intel Corporation. All rights reserved.<BR> 5 5 This program and the accompanying materials 6 6 are licensed and made available under the terms and conditions of the BSD License … … 50 50 preserved. The new value is returned. 51 51 52 If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). 53 52 54 @param Operand Operand on which to perform the bitfield operation. 53 55 @param StartBit The ordinal of the least significant bit in the bit field. … … 67 69 ) 68 70 { 71 // 72 // Higher bits in OrData those are not used must be zero. 73 // 74 // EndBit - StartBit + 1 might be 32 while the result right shifting 32 on a 32bit integer is undefined, 75 // So the logic is updated to right shift (EndBit - StartBit) bits and compare the last bit directly. 76 // 77 ASSERT ((OrData >> (EndBit - StartBit)) == ((OrData >> (EndBit - StartBit)) & 1)); 78 69 79 // 70 80 // ~((UINTN)-2 << EndBit) is a mask in which bit[0] thru bit[EndBit] … … 82 92 preserved. The new value is returned. 83 93 94 If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). 95 84 96 @param Operand Operand on which to perform the bitfield operation. 85 97 @param StartBit The ordinal of the least significant bit in the bit field. … … 99 111 ) 100 112 { 113 // 114 // Higher bits in AndData those are not used must be zero. 115 // 116 // EndBit - StartBit + 1 might be 32 while the result right shifting 32 on a 32bit integer is undefined, 117 // So the logic is updated to right shift (EndBit - StartBit) bits and compare the last bit directly. 118 // 119 ASSERT ((AndData >> (EndBit - StartBit)) == ((AndData >> (EndBit - StartBit)) & 1)); 120 101 121 // 102 122 // ~((UINTN)-2 << EndBit) is a mask in which bit[0] thru bit[EndBit] … … 149 169 If EndBit is greater than 7, then ASSERT(). 150 170 If EndBit is less than StartBit, then ASSERT(). 171 If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). 151 172 152 173 @param Operand Operand on which to perform the bitfield operation. … … 186 207 If EndBit is greater than 7, then ASSERT(). 187 208 If EndBit is less than StartBit, then ASSERT(). 209 If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). 188 210 189 211 @param Operand Operand on which to perform the bitfield operation. … … 223 245 If EndBit is greater than 7, then ASSERT(). 224 246 If EndBit is less than StartBit, then ASSERT(). 247 If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). 225 248 226 249 @param Operand Operand on which to perform the bitfield operation. … … 261 284 If EndBit is greater than 7, then ASSERT(). 262 285 If EndBit is less than StartBit, then ASSERT(). 286 If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). 287 If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). 263 288 264 289 @param Operand Operand on which to perform the bitfield operation. … … 336 361 If EndBit is greater than 15, then ASSERT(). 337 362 If EndBit is less than StartBit, then ASSERT(). 363 If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). 338 364 339 365 @param Operand Operand on which to perform the bitfield operation. … … 373 399 If EndBit is greater than 15, then ASSERT(). 374 400 If EndBit is less than StartBit, then ASSERT(). 401 If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). 375 402 376 403 @param Operand Operand on which to perform the bitfield operation. … … 410 437 If EndBit is greater than 15, then ASSERT(). 411 438 If EndBit is less than StartBit, then ASSERT(). 439 If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). 412 440 413 441 @param Operand Operand on which to perform the bitfield operation. … … 448 476 If EndBit is greater than 15, then ASSERT(). 449 477 If EndBit is less than StartBit, then ASSERT(). 478 If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). 479 If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). 450 480 451 481 @param Operand Operand on which to perform the bitfield operation. … … 523 553 If EndBit is greater than 31, then ASSERT(). 524 554 If EndBit is less than StartBit, then ASSERT(). 555 If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). 525 556 526 557 @param Operand Operand on which to perform the bitfield operation. … … 560 591 If EndBit is greater than 31, then ASSERT(). 561 592 If EndBit is less than StartBit, then ASSERT(). 593 If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). 562 594 563 595 @param Operand Operand on which to perform the bitfield operation. … … 597 629 If EndBit is greater than 31, then ASSERT(). 598 630 If EndBit is less than StartBit, then ASSERT(). 631 If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). 599 632 600 633 @param Operand Operand on which to perform the bitfield operation. … … 635 668 If EndBit is greater than 31, then ASSERT(). 636 669 If EndBit is less than StartBit, then ASSERT(). 670 If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). 671 If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). 637 672 638 673 @param Operand Operand on which to perform the bitfield operation. … … 710 745 If EndBit is greater than 63, then ASSERT(). 711 746 If EndBit is less than StartBit, then ASSERT(). 747 If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). 712 748 713 749 @param Operand Operand on which to perform the bitfield operation. … … 747 783 If EndBit is greater than 63, then ASSERT(). 748 784 If EndBit is less than StartBit, then ASSERT(). 785 If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). 749 786 750 787 @param Operand Operand on which to perform the bitfield operation. … … 772 809 ASSERT (EndBit < 64); 773 810 ASSERT (StartBit <= EndBit); 811 // 812 // Higher bits in OrData those are not used must be zero. 813 // 814 // EndBit - StartBit + 1 might be 64 while the result right shifting 64 on RShiftU64() API is invalid, 815 // So the logic is updated to right shift (EndBit - StartBit) bits and compare the last bit directly. 816 // 817 ASSERT (RShiftU64 (OrData, EndBit - StartBit) == (RShiftU64 (OrData, EndBit - StartBit) & 1)); 774 818 775 819 Value1 = LShiftU64 (OrData, StartBit); … … 791 835 If EndBit is greater than 63, then ASSERT(). 792 836 If EndBit is less than StartBit, then ASSERT(). 837 If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). 793 838 794 839 @param Operand Operand on which to perform the bitfield operation. … … 816 861 ASSERT (EndBit < 64); 817 862 ASSERT (StartBit <= EndBit); 863 // 864 // Higher bits in AndData those are not used must be zero. 865 // 866 // EndBit - StartBit + 1 might be 64 while the right shifting 64 on RShiftU64() API is invalid, 867 // So the logic is updated to right shift (EndBit - StartBit) bits and compare the last bit directly. 868 // 869 ASSERT (RShiftU64 (AndData, EndBit - StartBit) == (RShiftU64 (AndData, EndBit - StartBit) & 1)); 818 870 819 871 Value1 = LShiftU64 (~AndData, StartBit); … … 836 888 If EndBit is greater than 63, then ASSERT(). 837 889 If EndBit is less than StartBit, then ASSERT(). 890 If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). 891 If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). 838 892 839 893 @param Operand Operand on which to perform the bitfield operation.
Note:
See TracChangeset
for help on using the changeset viewer.