NetworkManager/shared
Thomas Haller 54203d986f shared: refactor nm_utils_is_power_of_two() to return false for 0
Returning TRUE for zero makes no sense. Obviously, zero is not a power
of two.

Also, the function is used to check whether a number has only one bit
(flag) set, so, an alternative name would be "has-one-bit-set", which
also should return FALSE for zero. All callers didn't really care for
the previous meaning "has-at-most-one-bit-set".

This also avoids the issue of checking (x >= 0), which causes
-Wtype-limits warnings for unsigned types. Which was avoided
by doing (x == 0 || x > 0), which caused -Wlogical-op warning,
which then was avoided (x == 0 || (x > 0 && 1)). Just don't.

(cherry picked from commit a2663803c3)
2017-05-22 14:03:08 +02:00
..
nm-utils shared: refactor nm_utils_is_power_of_two() to return false for 0 2017-05-22 14:03:08 +02:00
nm-common-macros.h all: modify line separator comments to be 80 chars wide 2016-10-03 12:01:15 +02:00
nm-dbus-compat.h build: rename directory "include" to "shared" 2015-12-24 11:42:37 +01:00
nm-default.h build: disable type checks in G_TYPE_CHECK_INSTANCE_CAST() macros (bgo#771120) 2016-09-12 13:53:34 +02:00
nm-dispatcher-api.h build: cleanup src/Makefile.am 2016-08-11 11:54:18 +02:00
nm-setting-metadata.c shared: move NMSetting8021xSchemeVtable to "shared/nm-setting-metadata.h" 2017-02-17 19:52:13 +01:00
nm-setting-metadata.h shared: move NMSetting8021xSchemeVtable to "shared/nm-setting-metadata.h" 2017-02-17 19:52:13 +01:00
nm-test-libnm-utils.h shared: move shared files to subdirectory "shared/nm-utils/" 2016-06-16 10:45:53 +02:00
nm-test-utils-impl.c build: allow specifying the python interpreter for building 2016-12-14 19:00:42 +01:00
nm-version-macros.h.in release: bump version to 1.7.0 (development) 2017-01-18 18:37:06 +01:00