diff --git a/src/modbus-version.h.in b/src/modbus-version.h.in index d2dcac8e3..8473d6597 100644 --- a/src/modbus-version.h.in +++ b/src/modbus-version.h.in @@ -35,10 +35,10 @@ */ #define LIBMODBUS_VERSION_STRING "@LIBMODBUS_VERSION@" -/* Numerically encoded version, like 0x010203 */ -#define LIBMODBUS_VERSION_HEX ((LIBMODBUS_VERSION_MAJOR << 24) | \ - (LIBMODBUS_VERSION_MINOR << 16) | \ - (LIBMODBUS_VERSION_MICRO << 8)) +/* Numerically encoded version, eg. v1.2.3 is 0x010203 */ +#define LIBMODBUS_VERSION_HEX ((LIBMODBUS_VERSION_MAJOR << 16) | \ + (LIBMODBUS_VERSION_MINOR << 8) | \ + (LIBMODBUS_VERSION_MICRO << 0)) /* Evaluates to True if the version is greater than @major, @minor and @micro */ diff --git a/tests/version.c b/tests/version.c index e830a38ef..d6db67966 100644 --- a/tests/version.c +++ b/tests/version.c @@ -9,7 +9,7 @@ int main(void) { - printf("Compiled with libmodbus version %s (%08X)\n", LIBMODBUS_VERSION_STRING, LIBMODBUS_VERSION_HEX); + printf("Compiled with libmodbus version %s (%06X)\n", LIBMODBUS_VERSION_STRING, LIBMODBUS_VERSION_HEX); printf("Linked with libmodbus version %d.%d.%d\n", libmodbus_version_major, libmodbus_version_minor, libmodbus_version_micro);