Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/ic simplify weird tests.



details:   https://anonhg.NetBSD.org/src/rev/70e1a2f1efd9
branches:  trunk
changeset: 581549:70e1a2f1efd9
user:      christos <christos%NetBSD.org@localhost>
date:      Thu Jun 02 14:32:12 2005 +0000

description:
simplify weird tests.

diffstat:

 sys/dev/ic/tea5757.c |  37 +++++++++++++------------------------
 1 files changed, 13 insertions(+), 24 deletions(-)

diffs (69 lines):

diff -r f3eae6475b54 -r 70e1a2f1efd9 sys/dev/ic/tea5757.c
--- a/sys/dev/ic/tea5757.c      Thu Jun 02 14:31:38 2005 +0000
+++ b/sys/dev/ic/tea5757.c      Thu Jun 02 14:32:12 2005 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: tea5757.c,v 1.3 2003/07/14 15:47:12 lukem Exp $ */
+/* $NetBSD: tea5757.c,v 1.4 2005/06/02 14:32:12 christos Exp $ */
 /*     $OpenBSD: tea5757.c,v 1.3 2002/01/07 18:32:19 mickey Exp $      */
 
 /*
@@ -53,7 +53,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: tea5757.c,v 1.3 2003/07/14 15:47:12 lukem Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tea5757.c,v 1.4 2005/06/02 14:32:12 christos Exp $");
 
 #include <sys/param.h>
 #include <sys/radioio.h>
@@ -155,39 +155,28 @@
 u_int32_t
 tea5757_encode_lock(u_int8_t lock)
 {
-       u_int32_t ret;
-
        if (lock < 8)
-               ret = TEA5757_S005;
-       else if (lock > 7 && lock < 15)
-               ret = TEA5757_S010;
-       else if (lock > 14 && lock < 51)
-               ret = TEA5757_S030;
-       else if (lock > 50)
-               ret = TEA5757_S150;
-
-       return ret;
+               return TEA5757_S005;
+       if (lock < 15)
+               return TEA5757_S010;
+       if (lock < 51)
+               return TEA5757_S030;
+       return TEA5757_S150;
 }
 
 u_int8_t
 tea5757_decode_lock(u_int32_t lock)
 {
-       u_int8_t ret = 150;
-
        switch (lock) {
        case TEA5757_S005:
-               ret = 5;
-               break;
+               return 5;
        case TEA5757_S010:
-               ret = 10;
+               return 10;
                break;
        case TEA5757_S030:
-               ret = 30;
-               break;
+               return 30;
        case TEA5757_S150:
-               ret = 150;
-               break;
+       default:
+               return 150;
        }
-
-       return ret;
 }



Home | Main Index | Thread Index | Old Index