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

Alexandre Abadie noreply at github.com
Thu Jul 23 12:14:12 CEST 2020


  Branch: refs/heads/2020.07-branch
  Home:   https://github.com/RIOT-OS/RIOT
  Commit: 0d98431c045ae6f5d34ac5897bad782e96cf1e0c
      https://github.com/RIOT-OS/RIOT/commit/0d98431c045ae6f5d34ac5897bad782e96cf1e0c
  Author: Benjamin Valentin <benpicco at googlemail.com>
  Date:   2020-07-23 (Thu, 23 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

(cherry picked from commit 46b89eb723024d5940729860fd753834b12361d1)


  Commit: 326ea4d148e7a901c7b4fe4cb1a4f8e79cb57991
      https://github.com/RIOT-OS/RIOT/commit/326ea4d148e7a901c7b4fe4cb1a4f8e79cb57991
  Author: Benjamin Valentin <benpicco at googlemail.com>
  Date:   2020-07-23 (Thu, 23 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

(cherry picked from commit 337ee3899749fb3fa385793b7f71345331b466ae)


  Commit: 4db714c46a1c79aee96fadf82bfda08ea91e69d9
      https://github.com/RIOT-OS/RIOT/commit/4db714c46a1c79aee96fadf82bfda08ea91e69d9
  Author: Alexandre Abadie <alexandre.abadie at inria.fr>
  Date:   2020-07-23 (Thu, 23 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 #14585 from benpicco/backport/2020.07/core/msg_bus-type

core/msg_bus: fix shift on 8-bit platforms [backport 2020.07]


Compare: https://github.com/RIOT-OS/RIOT/compare/0ea24e138cf8...4db714c46a1c


More information about the commits mailing list