Module Name:    src
Committed By:   christos
Date:           Thu Nov 20 16:26:35 UTC 2014

Modified Files:
        src/sys/dev: clock_subr.h

Log Message:
kill the macros that called the inlines bcdtobin and bintobcd and define
them directly here.


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.25 src/sys/dev/clock_subr.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/clock_subr.h
diff -u src/sys/dev/clock_subr.h:1.24 src/sys/dev/clock_subr.h:1.25
--- src/sys/dev/clock_subr.h:1.24	Thu Nov 20 10:49:28 2014
+++ src/sys/dev/clock_subr.h	Thu Nov 20 11:26:34 2014
@@ -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 @@ int	clock_secs_to_ymdhms(time_t, struct 
 /*
  * 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 @@ typedef struct todr_chip_handle *todr_ch
 /*
  * 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

Reply via email to