[riot-commits] [RIOT-OS/RIOT] 46b89e: core/msg_bus: fix shift on 8-bit platforms

benpicco noreply at github.com
Wed Jul 22 17:00:11 CEST 2020


  Branch: refs/heads/master
  Home:   https://github.com/RIOT-OS/RIOT
  Commit: 46b89eb723024d5940729860fd753834b12361d1
      https://github.com/RIOT-OS/RIOT/commit/46b89eb723024d5940729860fd753834b12361d1
  Author: Benjamin Valentin <benpicco at googlemail.com>
  Date:   2020-07-22 (Wed, 22 Jul 2020)

  Changed paths:
    M core/include/msg_bus.h
    M core/msg.c

  Log Message:
  -----------
  core/msg_bus: fix shift on 8-bit platforms

The previous shift would wrap if the compiler defaults to 16 bit words.
Use explicit `unsigned long` integer constants to mitigate that.

before:

2020-07-22 15:25:17,063 # THREAD 1 start
2020-07-22 15:25:17,063 # THREAD 2 start
2020-07-22 15:25:17,065 # THREAD 3 start
2020-07-22 15:25:17,066 # THREADS CREATED
2020-07-22 15:25:17,068 # Posted event 22 to 0 threads
2020-07-22 15:25:17,071 # Posted event 23 to 0 threads
2020-07-22 15:25:17,076 # Posted event 24 to 0 threads
2020-07-22 15:25:17,076 # SUCCESS
2020-07-22 15:26:00,188 # Exiting Pyterm

after:

2020-07-22 15:26:10,374 # THREAD 1 start
2020-07-22 15:26:10,374 # THREAD 2 start
2020-07-22 15:26:10,377 # THREAD 3 start
2020-07-22 15:26:10,377 # THREADS CREATED
2020-07-22 15:26:10,380 # Posted event 22 to 0 threads
2020-07-22 15:26:10,383 # T1 recv: Hello Threads! (type=23)
2020-07-22 15:26:10,386 # T3 recv: Hello Threads! (type=23)
2020-07-22 15:26:10,388 # Posted event 23 to 2 threads
2020-07-22 15:26:10,391 # T2 recv: Hello Threads! (type=24)
2020-07-22 15:26:10,394 # Posted event 24 to 1 threads
2020-07-22 15:26:10,396 # SUCCESS


  Commit: 337ee3899749fb3fa385793b7f71345331b466ae
      https://github.com/RIOT-OS/RIOT/commit/337ee3899749fb3fa385793b7f71345331b466ae
  Author: Benjamin Valentin <benpicco at googlemail.com>
  Date:   2020-07-22 (Wed, 22 Jul 2020)

  Changed paths:
    M tests/thread_msg_bus/main.c

  Log Message:
  -----------
  tests/thread_msg_bus: add check if all threads got the message


  Commit: dc21084ab59a5238f1b56b383c4ead0a55b14727
      https://github.com/RIOT-OS/RIOT/commit/dc21084ab59a5238f1b56b383c4ead0a55b14727
  Author: benpicco <benjamin.valentin at ml-pa.com>
  Date:   2020-07-22 (Wed, 22 Jul 2020)

  Changed paths:
    M core/include/msg_bus.h
    M core/msg.c
    M tests/thread_msg_bus/main.c

  Log Message:
  -----------
  Merge pull request #14582 from benpicco/core/msg_bus-type

core/msg_bus: fix shift on 8-bit platforms


Compare: https://github.com/RIOT-OS/RIOT/compare/d187e8322100...dc21084ab59a


More information about the commits mailing list