summaryrefslogtreecommitdiff
path: root/MdePkg/Library/BaseLib/BitField.c
diff options
context:
space:
mode:
authorvanjeff <vanjeff@6f19259b-4bc3-4df7-8a09-765794883524>2006-07-19 17:37:07 +0000
committervanjeff <vanjeff@6f19259b-4bc3-4df7-8a09-765794883524>2006-07-19 17:37:07 +0000
commit1ea5ca46c7eefe66a01cb4db3b72fc0e5a04e2cb (patch)
tree11db61e6d73e5a6b0bca974e7e4a8e29f1344a49 /MdePkg/Library/BaseLib/BitField.c
parentebfe209ec07c4105baba33576457a4bd6c798a2b (diff)
downloadedk2-platforms-1ea5ca46c7eefe66a01cb4db3b72fc0e5a04e2cb.tar.xz
1. added functions header for BaseUefiDecompressLi
2. added some internal functions header for BaseLib 3. added EFIAPI for some internal assembly files declare git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@1050 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'MdePkg/Library/BaseLib/BitField.c')
-rw-r--r--MdePkg/Library/BaseLib/BitField.c51
1 files changed, 46 insertions, 5 deletions
diff --git a/MdePkg/Library/BaseLib/BitField.c b/MdePkg/Library/BaseLib/BitField.c
index 9c1aff1c6f..0b517aa974 100644
--- a/MdePkg/Library/BaseLib/BitField.c
+++ b/MdePkg/Library/BaseLib/BitField.c
@@ -14,8 +14,19 @@
**/
+/**
+ Worker function that returns a bit field from Operand
+
+ Returns the bitfield specified by the StartBit and the EndBit from Operand.
+
+ @param Operand Operand on which to perform the bitfield operation.
+ @param StartBit The ordinal of the least significant bit in the bit field.
+ @param EndBit The ordinal of the most significant bit in the bit field.
+
+ @return The bit field read.
+
+**/
unsigned int
-EFIAPI
BitFieldReadUint (
IN unsigned int Operand,
IN UINTN StartBit,
@@ -29,8 +40,23 @@ BitFieldReadUint (
return (Operand & ~((unsigned int)-2 << EndBit)) >> StartBit;
}
+/**
+ Worker function that reads a bit field from Operand, performs a bitwise OR,
+ and returns the result.
+
+ Performs a bitwise OR between the bit field specified by StartBit and EndBit
+ in Operand and the value specified by AndData. All other bits in Operand are
+ preserved. The new value is returned.
+
+ @param Operand Operand on which to perform the bitfield operation.
+ @param StartBit The ordinal of the least significant bit in the bit field.
+ @param EndBit The ordinal of the most significant bit in the bit field.
+ @param OrData The value to OR with the read value from the value
+
+ @return The new value.
+
+**/
unsigned int
-EFIAPI
BitFieldOrUint (
IN unsigned int Operand,
IN UINTN StartBit,
@@ -42,11 +68,26 @@ BitFieldOrUint (
// ~((unsigned int)-2 << EndBit) is a mask in which bit[0] thru bit[EndBit]
// are 1's while bit[EndBit + 1] thru the most significant bit are 0's.
//
- return Operand | ((OrData << StartBit) & ~((unsigned int)-2 << EndBit));
+ return Operand | ((OrData << StartBit) & ~((unsigned int) -2 << EndBit));
}
+/**
+ Worker function that reads a bit field from Operand, performs a bitwise AND,
+ and returns the result.
+
+ Performs a bitwise AND between the bit field specified by StartBit and EndBit
+ in Operand and the value specified by AndData. All other bits in Operand are
+ preserved. The new value is returned.
+
+ @param Operand Operand on which to perform the bitfield operation.
+ @param StartBit The ordinal of the least significant bit in the bit field.
+ @param EndBit The ordinal of the most significant bit in the bit field.
+ @param AndData The value to And with the read value from the value
+
+ @return The new value.
+
+**/
unsigned int
-EFIAPI
BitFieldAndUint (
IN unsigned int Operand,
IN UINTN StartBit,
@@ -58,7 +99,7 @@ BitFieldAndUint (
// ~((unsigned int)-2 << EndBit) is a mask in which bit[0] thru bit[EndBit]
// are 1's while bit[EndBit + 1] thru the most significant bit are 0's.
//
- return Operand & ~((~AndData << StartBit) & ~((unsigned int)-2 << EndBit));
+ return Operand & ~((~AndData << StartBit) & ~((unsigned int) -2 << EndBit));
}
/**