Bluetooth: Mesh: Fix HB Pub Count Log calculation routine
Bluetooth: Mesh: Fix HB Pub Count Log calculation routine

"4.1.2 Log field transformation

In order to compress two-octet values into one-octet fields, the
following logarithmic transformation is used: any two-octet value is
mapped onto a one-octet field value representing the largest integer
n, where 2^(n-1) is less than or equal to the two-octet value."

Log field transformation table:

Log Field Value         2-octet Value
0x01                    0x0001
0x02                    0x0002 through 0x0003
0x03                    0x0004 through 0x0007
0x04                    0x0008 through 0x000F
0x05                    0x0010 through 0x001F
0x06                    0x0020 through 0x003F
0x07                    0x0040 through 0x007F
0x08                    0x0080 through 0x00FF
0x09                    0x0100 through 0x01FF
0x0A                    0x0200 through 0x03FF
0x0B                    0x0400 through 0x07FF
0x0C                    0x0800 through 0x0FFF
0x0D                    0x1000 through 0x1FFF
0x0E                    0x2000 through 0x3FFF
0x0F                    0x4000 through 0x7FFF
0x10                    0x8000 through 0xFFFF

"4.2.17.2 Heartbeat Publication Count Log

The Heartbeat Publication Count Log value between 0x01 and 0x11 shall
represent that smallest integer n where 2^(n-1) is greater than or
equal to the Heartbeat Publication Count value. For example, if the
Heartbeat Publication Count value is 0x0579, then the Heartbeat
Publication Count Log value would be 0x0C."

According to this definition 2^(n-1) is an upper bound for n log
value.

Proposed Publication Count Log transformation table:

Pub Count Log Value     2-octet Value
0x01                    0x0001
0x02                    0x0002
0x03                    0x0003 through 0x0004
0x04                    0x0005 through 0x0008
0x05                    0x0009 through 0x0010
0x06                    0x0011 through 0x0020
0x07                    0x0021 through 0x0040
0x08                    0x0041 through 0x0080
0x09                    0x0081 through 0x0100
0x0A                    0x0101 through 0x0200
0x0B                    0x0201 through 0x0400
0x0C                    0x0401 through 0x0800
0x0D                    0x0801 through 0x1000
0x0E                    0x1001 through 0x2000
0x0F                    0x2001 through 0x4000
0x10                    0x4001 through 0x8000
0x11                    0x8001 through 0x10000

According to Log field transformation table 0x0579 would be
transformed to 0x0B and should be to transformed to 0x0C.

This is required to pass MESH/NODE/CFG/HBP/BV-01-C.

Signed-off-by: Johan Hedberg <628991c7b0a19c384f9b99c21ec330ce952bb838@intel.com>

mbolivar/zephyr,finikorg/zephyr,zephyriot/zephyr,GiulianoFranchetto/zephyr,zephyrproject-rtos/zephyr,nashif/zephyr,zephyrproject-rtos/zephyr,punitvara/zephyr,galak/zephyr,kraj/zephyr,mbolivar/zephyr,nashif/zephyr,kraj/zephyr,mbolivar/zephyr,aceofall/zephyr-iotos,galak/zephyr,finikorg/zephyr,Vudentz/zephyr,punitvara/zephyr,punitvara/zephyr,mbolivar/zephyr,ldts/zephyr,aceofall/zephyr-iotos,nashif/zephyr,finikorg/zephyr,explora26/zephyr,GiulianoFranchetto/zephyr,aceofall/zephyr-iotos,kraj/zephyr,zephyrproject-rtos/zephyr,zephyrproject-rtos/zephyr,galak/zephyr,finikorg/zephyr,ldts/zephyr,Vudentz/zephyr,galak/zephyr,zephyriot/zephyr,finikorg/zephyr,zephyriot/zephyr,Vudentz/zephyr,aceofall/zephyr-iotos,galak/zephyr,explora26/zephyr,explora26/zephyr,kraj/zephyr,ldts/zephyr,zephyrproject-rtos/zephyr,nashif/zephyr,Vudentz/zephyr,GiulianoFranchetto/zephyr,ldts/zephyr,GiulianoFranchetto/zephyr,explora26/zephyr,Vudentz/zephyr,kraj/zephyr,Vudentz/zephyr,aceofall/zephyr-iotos,GiulianoFranchetto/zephyr,punitvara/zephyr,mbolivar/zephyr,ldts/zephyr,punitvara/zephyr,nashif/zephyr,explora26/zephyr,zephyriot/zephyr,zephyriot/zephyr