mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-09-25 18:54:06 +00:00
hv: create 8-bit sum function
Move 8-bit sum code to a separate new function calculate_sum8() in util.h and replace the old code with a call to calculate_sum8() Minor code cleanup in found_rsdp() to make it more readable. Both break and continue statements are used in a single for loop, changed to only use break statement to make the logic simpler. Fixed some coding style issues reported by checkpatch.pl for file hypervisor/boot/acpi_base.c Tracked-On: #3601 Signed-off-by: dongshen <dongsheng.x.zhang@intel.com> Reviewed-by: Eddie Dong <eddie.dong@intel.com>
This commit is contained in:
@@ -31,4 +31,19 @@ static inline bool mem_aligned_check(uint64_t value, uint64_t req_align)
|
||||
return ((value & (req_align - 1UL)) == 0UL);
|
||||
}
|
||||
|
||||
/**
|
||||
* @pre buf != NULL
|
||||
*/
|
||||
static inline uint8_t calculate_sum8(const void *buf, uint32_t length)
|
||||
{
|
||||
uint32_t i;
|
||||
uint8_t sum = 0U;
|
||||
|
||||
for (i = 0U; i < length; i++) {
|
||||
sum += *((const uint8_t *)buf + i);
|
||||
}
|
||||
|
||||
return sum;
|
||||
}
|
||||
|
||||
#endif /* UTIL_H */
|
||||
|
Reference in New Issue
Block a user