From 9f552ff5aa043eddc5b6d59db09728d83faf97dd Mon Sep 17 00:00:00 2001 From: Randall Spangler Date: Fri, 20 Apr 2012 13:07:42 -0700 Subject: Implement 64-bit integer printing in uart_printf() Signed-off-by: Randall Spangler BUG=chrome-os-partner:7490 TEST=timerinfo; numbers should look reasonable Change-Id: I698be99c87bf311013427ac0ed9e93e5687f40c0 --- include/util.h | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) (limited to 'include/util.h') diff --git a/include/util.h b/include/util.h index d11b3a587f..5b9dd364db 100644 --- a/include/util.h +++ b/include/util.h @@ -1,15 +1,14 @@ -/* Copyright (c) 2011 The Chromium OS Authors. All rights reserved. +/* Copyright (c) 2012 The Chromium OS Authors. All rights reserved. * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ /* Various utility functions and macros */ -#ifndef __UTIL_H -#define __UTIL_H - -#include +#ifndef __CROS_EC_UTIL_H +#define __CROS_EC_UTIL_H +#include "common.h" #include "config.h" /** @@ -60,7 +59,18 @@ void *memset(void *dest, int c, int len); int strcasecmp(const char *s1, const char *s2); int strlen(const char *s); int strtoi(const char *nptr, char **endptr, int base); + +/* Like strncpy(), but guarantees null termination. */ char *strzcpy(char *dest, const char *src, int len); + int tolower(int c); -#endif /* __UTIL_H */ +/* 64-bit divide-and-modulo. Does the equivalent of: + * + * r = *n % d; + * *n /= d; + * return r; + */ +int uint64divmod(uint64_t *v, int by); + +#endif /* __CROS_EC_UTIL_H */ -- cgit v1.2.1