Skip to content

Commit

Permalink
Add compare function
Browse files Browse the repository at this point in the history
  • Loading branch information
Ali-Mirghasemi committed Nov 26, 2022
1 parent 15bfd18 commit 2bb8343
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
11 changes: 11 additions & 0 deletions Src/StreamBuffer.c
Original file line number Diff line number Diff line change
Expand Up @@ -2267,6 +2267,17 @@ Stream_LenType Stream_findDoubleAt(Stream* stream, Stream_LenType offset, double

#endif // STREAM_FIND_FUNCTIONS

/**
* @brief compare a given bytes at index with available bytes in stream
*
* @param stream
* @param val
* @param len
* @return int8_t
*/
int8_t Stream_compare(Stream* stream, const uint8_t* val, Stream_LenType len) {
return Stream_compareAt(stream, 0, val, len);
}
/**
* @brief compare a given bytes at index with available bytes in stream
*
Expand Down
1 change: 1 addition & 0 deletions Src/StreamBuffer.h
Original file line number Diff line number Diff line change
Expand Up @@ -459,6 +459,7 @@ Stream_Result Stream_getFloatArrayAt(Stream* stream, Stream_LenType index, float
Stream_LenType Stream_readBytesUntilPattern(Stream* stream, const uint8_t* pat, Stream_LenType patLen, uint8_t* val, Stream_LenType len);
#endif // STREAM_FIND_FUNCTIONS

int8_t Stream_compare(Stream* stream, const uint8_t* val, Stream_LenType len);
int8_t Stream_compareAt(Stream* stream, Stream_LenType index, const uint8_t* val, Stream_LenType len);

#ifdef __cplusplus
Expand Down

0 comments on commit 2bb8343

Please sign in to comment.