Evrythng API for W5500, WIZ550io
Dependencies: W5500Interface
Dependents: EvrythngApiExampleW5500
Fork of EvrythngApi by
util.cpp
00001 /* 00002 * (c) Copyright 2012 EVRYTHNG Ltd London / Zurich 00003 * www.evrythng.com 00004 * 00005 * --- DISCLAIMER --- 00006 * 00007 * EVRYTHNG provides this source code "as is" and without warranty of any kind, 00008 * and hereby disclaims all express or implied warranties, including without 00009 * limitation warranties of merchantability, fitness for a particular purpose, 00010 * performance, accuracy, reliability, and non-infringement. 00011 * 00012 * Author: Michel Yerly 00013 * 00014 */ 00015 #include "util.h" 00016 00017 Serial dbg(USBTX, USBRX); 00018 00019 00020 void sprinti64(char* dest, int64_t v, char** end) 00021 { 00022 int len; 00023 if (v != 0x8000000000000000LL) { 00024 char str[20]; 00025 int p = sizeof(str); 00026 str[--p] = '\0'; 00027 str[p-1] = '0'; 00028 bool neg = false; 00029 if (v < 0) { 00030 v = -v; 00031 neg = true; 00032 } 00033 while (v > 0) { 00034 str[--p] = '0' + (v % 10); 00035 v /= 10; 00036 } 00037 if (neg) { 00038 str[--p] = '-'; 00039 } 00040 len = sizeof(str) - p; 00041 strncpy(dest, str + p, len); 00042 } else { 00043 len = 20; 00044 strncpy(dest, "-9223372036854775808", len); 00045 } *end = dest + len; 00046 }
Generated on Wed Jul 20 2022 03:34:21 by 1.7.2