removes platform dependency in libwrap

This commit is contained in:
Eyck-Alexander Jentzsch 2025-01-06 20:45:20 +01:00
parent 6cd7ea887a
commit e652e59dac
2 changed files with 5 additions and 8 deletions

View File

@ -2,17 +2,15 @@
#include <stdint.h> #include <stdint.h>
#include <unistd.h> #include <unistd.h>
#include "platform.h"
void write_hex(int fd, uint32_t hex) void write_hex(int fd, uint32_t hex) {
{
uint8_t ii; uint8_t ii;
uint8_t jj; uint8_t jj;
char towrite; char towrite;
write(fd , "0x", 2); write(fd, "0x", 2);
for (ii = 8 ; ii > 0; ii--) { for (ii = 8; ii > 0; ii--) {
jj = ii - 1; jj = ii - 1;
uint8_t digit = ((hex & (0xF << (jj*4))) >> (jj*4)); uint8_t digit = ((hex & (0xF << (jj * 4))) >> (jj * 4));
towrite = digit < 0xA ? ('0' + digit) : ('A' + (digit - 0xA)); towrite = digit < 0xA ? ('0' + digit) : ('A' + (digit - 0xA));
write(fd, &towrite, 1); write(fd, &towrite, 1);
} }

View File

@ -1,6 +1,5 @@
/* See LICENSE of license details. */ /* See LICENSE of license details. */
#include "platform.h"
#include "weak_under_alias.h" #include "weak_under_alias.h"
#include <unistd.h> #include <unistd.h>
#if defined(SEMIHOSTING) #if defined(SEMIHOSTING)