Use uintptr_t for pointer-to-int
This commit is contained in:
committed by
Scott Lahteine
parent
7a8e99de7d
commit
8af8ef4404
@ -20,12 +20,12 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include "../inc/MarlinConfig.h"
|
||||
#include "../gcode/parser.h"
|
||||
#include "../inc/MarlinConfigPre.h"
|
||||
|
||||
#if NEED_HEX_PRINT
|
||||
|
||||
#include "hex_print.h"
|
||||
#include "../core/serial.h"
|
||||
|
||||
#ifdef CPU_32_BIT
|
||||
constexpr int byte_start = 4;
|
||||
@ -54,7 +54,7 @@ char* hex_word(const uint16_t w) {
|
||||
}
|
||||
|
||||
#ifdef CPU_32_BIT
|
||||
char* hex_long(const uint32_t l) {
|
||||
char* hex_long(const uintptr_t l) {
|
||||
_hex[2] = hex_nybble(l >> 28);
|
||||
_hex[3] = hex_nybble(l >> 24);
|
||||
_hex[4] = hex_nybble(l >> 20);
|
||||
@ -66,9 +66,9 @@ char* hex_word(const uint16_t w) {
|
||||
|
||||
char* hex_address(const void * const w) {
|
||||
#ifdef CPU_32_BIT
|
||||
(void)hex_long((ptr_int_t)w);
|
||||
(void)hex_long((uintptr_t)w);
|
||||
#else
|
||||
(void)hex_word((ptr_int_t)w);
|
||||
(void)hex_word((uintptr_t)w);
|
||||
#endif
|
||||
return _hex;
|
||||
}
|
||||
@ -78,7 +78,7 @@ void print_hex_byte(const uint8_t b) { SERIAL_ECHO(hex_byte(b)); }
|
||||
void print_hex_word(const uint16_t w) { SERIAL_ECHO(hex_word(w)); }
|
||||
void print_hex_address(const void * const w) { SERIAL_ECHO(hex_address(w)); }
|
||||
|
||||
void print_hex_long(const uint32_t w, const char delimiter) {
|
||||
void print_hex_long(const uintptr_t w, const char delimiter) {
|
||||
SERIAL_ECHOPGM("0x");
|
||||
for (int B = 24; B >= 8; B -= 8){
|
||||
print_hex_byte(w >> B);
|
||||
|
@ -39,9 +39,3 @@ void print_hex_byte(const uint8_t b);
|
||||
void print_hex_word(const uint16_t w);
|
||||
void print_hex_address(const void * const w);
|
||||
void print_hex_long(const uint32_t w, const char delimiter);
|
||||
|
||||
#ifdef CPU_32_BIT
|
||||
typedef uint32_t ptr_int_t;
|
||||
#else
|
||||
typedef uint16_t ptr_int_t;
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user