Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev kill the macros that called the inlines bcdtobin and...
details: https://anonhg.NetBSD.org/src/rev/18ff1b0040f8
branches: trunk
changeset: 333882:18ff1b0040f8
user: christos <christos%NetBSD.org@localhost>
date: Thu Nov 20 16:26:34 2014 +0000
description:
kill the macros that called the inlines bcdtobin and bintobcd and define
them directly here.
diffstat:
sys/dev/clock_subr.h | 19 ++++++++++++++-----
1 files changed, 14 insertions(+), 5 deletions(-)
diffs (40 lines):
diff -r f93a09bd8537 -r 18ff1b0040f8 sys/dev/clock_subr.h
--- a/sys/dev/clock_subr.h Thu Nov 20 16:25:16 2014 +0000
+++ b/sys/dev/clock_subr.h Thu Nov 20 16:26:34 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: clock_subr.h,v 1.24 2014/11/20 15:49:28 christos Exp $ */
+/* $NetBSD: clock_subr.h,v 1.25 2014/11/20 16:26:34 christos Exp $ */
/*-
* Copyright (c) 1996 The NetBSD Foundation, Inc.
@@ -53,8 +53,17 @@
/*
* BCD to binary and binary to BCD.
*/
-#define FROMBCD(x) bcdtobin((x))
-#define TOBCD(x) bintobcd((x))
+static inline unsigned int
+bcdtobin(unsigned int bcd)
+{
+ return ((bcd >> 4) & 0x0f) * 10 + (bcd & 0x0f);
+}
+
+static inline unsigned int
+bintobcd(unsigned int bin)
+{
+ return (((bin / 10) << 4) & 0xf0) | (bin % 10);
+}
/*
* Interface to time-of-day clock devices.
@@ -90,8 +99,8 @@
/*
* Probably these should evolve into internal routines in kern_todr.c.
*/
-extern int todr_gettime(todr_chip_handle_t tch, struct timeval *);
-extern int todr_settime(todr_chip_handle_t tch, struct timeval *);
+extern int todr_gettime(todr_chip_handle_t, struct timeval *);
+extern int todr_settime(todr_chip_handle_t, struct timeval *);
/*
* Machine-dependent function that machine-independent RTC drivers can
Home |
Main Index |
Thread Index |
Old Index