NetworkManager/shared/nm-utils
Thomas Haller a2663803c3 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.
2017-05-22 14:01:07 +02:00
..
c-list.h shared: add "nm-utils/c-list.h" header 2017-05-11 18:26:07 +02:00
gsystem-local-alloc.h shared: move shared files to subdirectory "shared/nm-utils/" 2016-06-16 10:45:53 +02:00
nm-enum-utils.c shared: cast from/to argument to unsigned for GFlags in _nm_utils_enum_get_values() 2017-04-27 18:01:58 +02:00
nm-enum-utils.h libnm: move public nm_utils_enum_*() functions back to libnm-core 2017-04-05 18:38:31 +02:00
nm-glib.h all: use "static inline" keywords instead of "inline static" 2017-02-23 15:28:27 +01:00
nm-macros-internal.h shared: refactor nm_utils_is_power_of_two() to return false for 0 2017-05-22 14:01:07 +02:00
nm-shared-utils.c shared: add nm_utils_str_utf8safe_*() API to sanitize UTF-8 strings 2017-05-19 09:46:08 +02:00
nm-shared-utils.h shared: add nm_utils_str_utf8safe_*() API to sanitize UTF-8 strings 2017-05-19 09:46:08 +02:00
nm-test-utils.h all: use "static inline" instead of "inline static" 2017-03-14 11:23:46 +01:00
nm-udev-utils.c libnm: don't cunescape \x00 encoding in nm_udev_utils_property_decode() 2017-05-19 09:46:08 +02:00
nm-udev-utils.h udev: add and use nm_udev_utils_property_decode() function 2017-03-22 12:41:06 +01:00
nm-vpn-editor-plugin-call.h shared: include "gsystem-local-alloc.h" from "nm-glib.h" 2016-06-16 10:45:54 +02:00
nm-vpn-plugin-macros.h shared: add nm_utils_syslog_coerce_from_nm() util 2016-09-19 15:35:33 +02:00
nm-vpn-plugin-utils.c shared: add "nm-utils/nm-vpn-plugin-utils.h" 2016-06-16 10:45:54 +02:00
nm-vpn-plugin-utils.h shared: add "nm-utils/nm-vpn-plugin-utils.h" 2016-06-16 10:45:54 +02:00
unaligned.h shared: add unaligned.h 2016-10-14 11:16:13 +02:00