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

View File

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