1. 增加获取栈指定位置的数据
This commit is contained in:
parent
4cfecb4117
commit
f9444f3dbf
@ -107,6 +107,9 @@ HByteDataType HByteStackPop(HByteType *stackData);
|
|||||||
// 返回栈顶数据, 失败返回 HBYTE_STACK_ERROR
|
// 返回栈顶数据, 失败返回 HBYTE_STACK_ERROR
|
||||||
HByteDataType HByteStackTop(const HByteType *stackData);
|
HByteDataType HByteStackTop(const HByteType *stackData);
|
||||||
|
|
||||||
|
// 返回指定位置数据, 失败返回 HBYTE_STACK_ERROR
|
||||||
|
HByteDataType HByteStackGetPos(const HByteType *stackData, HByteLenType pos);
|
||||||
|
|
||||||
// 返回栈长度
|
// 返回栈长度
|
||||||
HByteLenType HByteStackLen(const HByteType *stackData);
|
HByteLenType HByteStackLen(const HByteType *stackData);
|
||||||
|
|
||||||
|
|||||||
@ -113,6 +113,15 @@ HByteDataType HByteStackTop(const HByteType *stackData) {
|
|||||||
return GetStackData(stackData, GetStackUseLen(stackData) - 1);
|
return GetStackData(stackData, GetStackUseLen(stackData) - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 返回指定位置数据, 失败返回 HBYTE_STACK_ERROR
|
||||||
|
HByteDataType HByteStackGetPos(const HByteType *stackData, HByteLenType pos) {
|
||||||
|
if (pos >= GetStackUseLen(stackData)) {
|
||||||
|
return HBYTE_STACK_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
|
return GetStackData(stackData, pos);
|
||||||
|
}
|
||||||
|
|
||||||
HByteLenType HByteStackLen(const HByteType *stackData) {
|
HByteLenType HByteStackLen(const HByteType *stackData) {
|
||||||
return GetStackLen(stackData);
|
return GetStackLen(stackData);
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user