X-Git-Url: https://git.cryptolib.org/?a=blobdiff_plain;f=test_src%2Fstring-extras.c;h=52ceab67f996723caf1b70a08041d1fcf8978e84;hb=56d9a247a97dac764f88bc8ba41f527091c637fd;hp=8f216c2daee6cc5c0b8adfad40a38fbd02611531;hpb=498cf95d73faff93a848d2c0ffec3987769670bb;p=arm-crypto-lib.git diff --git a/test_src/string-extras.c b/test_src/string-extras.c index 8f216c2..52ceab6 100644 --- a/test_src/string-extras.c +++ b/test_src/string-extras.c @@ -1,6 +1,6 @@ /* string_extras.c */ /* - This file is part of the AVR-Crypto-Lib. + This file is part of the ARM-Crypto-Lib. Copyright (C) 2008 Daniel Otte (daniel.otte@rub.de) This program is free software: you can redistribute it and/or modify @@ -40,6 +40,7 @@ uint32_t stridentcnt(const char* a, const char* b){ a++; b++; } + return 0; } uint16_t firstword_length(const char* s){ @@ -96,7 +97,11 @@ char* ultoa(unsigned long a, char* buffer, uint8_t radix){ return buffer; } while(a){ + /* toolchain bug?? result = div(a, radix); + */ + result.quot = a/radix; + result.rem = a%radix; *ptr = result.rem; if(result.rem<10){ *ptr += '0'; @@ -151,3 +156,16 @@ void strlwr(char* s){ } } */ + +char* utoa(unsigned a, char* buffer, uint8_t radix){ + return ultoa((unsigned)a, buffer, radix); +} + +char* itoa(int a, char* buffer, uint8_t radix){ + if(a<0){ + *buffer = '-'; + a = -a; + } + ultoa(a, buffer + 1, radix); + return buffer; +}