diff options
author | Randall Spangler <rspangler@chromium.org> | 2012-04-20 13:07:42 -0700 |
---|---|---|
committer | Randall Spangler <rspangler@chromium.org> | 2012-04-20 14:01:11 -0700 |
commit | 9f552ff5aa043eddc5b6d59db09728d83faf97dd (patch) | |
tree | e7f39070eac9b14a9afa6363703eab0950e856cc /include/util.h | |
parent | a05deade13c696643ca6f8cc216f78db015a7ddb (diff) | |
download | chrome-ec-9f552ff5aa043eddc5b6d59db09728d83faf97dd.tar.gz |
Implement 64-bit integer printing in uart_printf()
Signed-off-by: Randall Spangler <rspangler@chromium.org>
BUG=chrome-os-partner:7490
TEST=timerinfo; numbers should look reasonable
Change-Id: I698be99c87bf311013427ac0ed9e93e5687f40c0
Diffstat (limited to 'include/util.h')
-rw-r--r-- | include/util.h | 22 |
1 files changed, 16 insertions, 6 deletions
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 <stdint.h> +#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 */ |