Fix definition of uc_version

This commit is contained in:
Robert Xiao 2023-05-13 00:56:07 -07:00
parent 32e638dcf4
commit 77d4a1d8b1
2 changed files with 6 additions and 8 deletions

View File

@ -161,9 +161,9 @@ public class Unicorn
/**
* Return combined API version & major and minor version numbers.
*
* @return version number as {@code (major << 8 | minor)}, which encodes
* both major & minor versions.
* For example, Unicorn version 1.2 would yield 0x0102.
* @return version number as {@code (major << 24 | minor << 16 |
* patch << 8 | extra)}.
* For example, Unicorn version 2.0.1 final would be 0x020001ff.
*/
public static int version() {
return _version();

View File

@ -86,7 +86,7 @@ typedef size_t uc_hook;
Macro to create combined version which can be compared to
result of uc_version() API.
*/
#define UC_MAKE_VERSION(major, minor) ((major << 8) + minor)
#define UC_MAKE_VERSION(major, minor) (((major) << 24) + ((minor) << 16))
// Scales to calculate timeout on microsecond unit
// 1 second = 1000,000 microseconds
@ -673,13 +673,11 @@ typedef struct uc_context uc_context;
@major: major number of API version
@minor: minor number of API version
@return hexical number as (major << 8 | minor), which encodes both
major & minor versions.
@return hexadecimal number as (major << 24 | minor << 16 | patch << 8 | extra).
NOTE: This returned value can be compared with version number made
with macro UC_MAKE_VERSION
For example, second API version would return 1 in @major, and 1 in @minor
The return value would be 0x0101
For example, Unicorn version 2.0.1 final would be 0x020001ff.
NOTE: if you only care about returned value, but not major and minor values,
set both @major & @minor arguments to NULL.