Home | History | Annotate | Line # | Download | only in ofw
ofw_subr.c revision 1.1
      1  1.1  cgd /*	$NetBSD: ofw_subr.c,v 1.1 1998/01/26 21:48:40 cgd Exp $	*/
      2  1.1  cgd 
      3  1.1  cgd /*
      4  1.1  cgd  * Copyright 1998
      5  1.1  cgd  * Digital Equipment Corporation. All rights reserved.
      6  1.1  cgd  *
      7  1.1  cgd  * This software is furnished under license and may be used and
      8  1.1  cgd  * copied only in accordance with the following terms and conditions.
      9  1.1  cgd  * Subject to these conditions, you may download, copy, install,
     10  1.1  cgd  * use, modify and distribute this software in source and/or binary
     11  1.1  cgd  * form. No title or ownership is transferred hereby.
     12  1.1  cgd  *
     13  1.1  cgd  * 1) Any source code used, modified or distributed must reproduce
     14  1.1  cgd  *    and retain this copyright notice and list of conditions as
     15  1.1  cgd  *    they appear in the source file.
     16  1.1  cgd  *
     17  1.1  cgd  * 2) No right is granted to use any trade name, trademark, or logo of
     18  1.1  cgd  *    Digital Equipment Corporation. Neither the "Digital Equipment
     19  1.1  cgd  *    Corporation" name nor any trademark or logo of Digital Equipment
     20  1.1  cgd  *    Corporation may be used to endorse or promote products derived
     21  1.1  cgd  *    from this software without the prior written permission of
     22  1.1  cgd  *    Digital Equipment Corporation.
     23  1.1  cgd  *
     24  1.1  cgd  * 3) This software is provided "AS-IS" and any express or implied
     25  1.1  cgd  *    warranties, including but not limited to, any implied warranties
     26  1.1  cgd  *    of merchantability, fitness for a particular purpose, or
     27  1.1  cgd  *    non-infringement are disclaimed. In no event shall DIGITAL be
     28  1.1  cgd  *    liable for any damages whatsoever, and in particular, DIGITAL
     29  1.1  cgd  *    shall not be liable for special, indirect, consequential, or
     30  1.1  cgd  *    incidental damages or damages for lost profits, loss of
     31  1.1  cgd  *    revenue or loss of use, whether such damages arise in contract,
     32  1.1  cgd  *    negligence, tort, under statute, in equity, at law or otherwise,
     33  1.1  cgd  *    even if advised of the possibility of such damage.
     34  1.1  cgd  */
     35  1.1  cgd 
     36  1.1  cgd /*
     37  1.1  cgd  *  This routine converts OFW encoded-int datums
     38  1.1  cgd  *  into the integer format of the host machine.
     39  1.1  cgd  *
     40  1.1  cgd  *  It is primarily used to convert integer properties
     41  1.1  cgd  *  returned by the OF_getprop routine.
     42  1.1  cgd  */
     43  1.1  cgd int
     44  1.1  cgd of_decode_int(p)
     45  1.1  cgd 	const unsigned char *p;
     46  1.1  cgd {
     47  1.1  cgd 	unsigned int i = *p++ << 8;
     48  1.1  cgd 	i = (i + *p++) << 8;
     49  1.1  cgd 	i = (i + *p++) << 8;
     50  1.1  cgd 	return (i + *p);
     51  1.1  cgd }
     52