diff --git a/src/gausskernel/cbb/bbox/bbox_elf_dump_base.cpp b/src/gausskernel/cbb/bbox/bbox_elf_dump_base.cpp index 6e2a265f..c4f96560 100644 --- a/src/gausskernel/cbb/bbox/bbox_elf_dump_base.cpp +++ b/src/gausskernel/cbb/bbox/bbox_elf_dump_base.cpp @@ -44,11 +44,22 @@ static int g_iPosBlackList = 0; /* array store for black list */ static BBOX_BLACKLIST_STRU g_stBlackList[BBOX_BLACK_LIST_COUNT_MAX]; -/* - * Determines whether the byte order of the local machine is large or small - * return : ELFDATA2LSB - large - * : ELFDATA2MSB - small - */ + /* +function name: BBOX_DetermineMsb +description: The function should judge the mode that PC uses to store data is Big-endian/Little-endian. +arguments: void +return value: An integer that indicates the mode is Big-endian/Little-endian, + if it is ELFDATA2LSB, the mode is Little-endian, + if it is ELFDATA2MSB, the mode is Big-endian. +note:The way that this function judge the mode that PC uses to store data is through a union variable unProbe, + at first we give its first member variable sShortInt a value BBOX_MSB_LSB_INT of type short, then its second + member variable cSplit[sizeof(short)] equaling to cSplit[2] would have the equal value of the first. Finally we + just need to compare BBOX_LITTER_BITS and BBOX_HIGH_BITS, namely the low byte and high byte of + BBOX_MSB_LSB_INT, with unProbe.cSplit[0] and unProbe.cSplit[1], if they are correspondingly equal, the mode is + Little-endian, else is the Big-endian. +date: 2022/8/2 +contact tel: 18720816902 + */ int BBOX_DetermineMsb(void) { union INT_PROBE {