Changeset 2f52893 in rtems-libbsd


Ignore:
Timestamp:
Apr 18, 2012, 3:14:02 PM (8 years ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
4.11, afaeccc05a556f6aa25ba044a7e49d6aa634a59e, freebsd-9.3, master
Children:
e2b2fc6
Parents:
89466ac
git-author:
Sebastian Huber <sebastian.huber@…> (04/18/12 15:14:02)
git-committer:
Sebastian Huber <sebastian.huber@…> (04/18/12 15:17:55)
Message:

Move bswap64()

Add copyright notice of FreeBSD "sys/powerpc/include/endian.h". Change
license to BSD.

Files:
2 edited

Legend:

Unmodified
Added
Removed
  • freebsd/sys/endian.h

    r89466ac r2f52893  
    198198}
    199199
    200 /*
    201  * In FreeBSD, this can be CPU specific but most targets use this
    202  * implementation.
    203  *
    204  * This is from the powerpc implementation.
    205  */
    206 static __inline uint64_t
    207 __bswap64(uint64_t _x)
    208 {
    209 
    210         return ((_x >> 56) | ((_x >> 40) & 0xff00) | ((_x >> 24) & 0xff0000) |
    211             ((_x >> 8) & 0xff000000) | ((_x << 8) & ((__uint64_t)0xff << 32)) |
    212             ((_x << 24) & ((__uint64_t)0xff << 40)) |
    213             ((_x << 40) & ((__uint64_t)0xff << 48)) | ((_x << 56)));
    214 }
    215 
    216200#endif  /* _SYS_ENDIAN_HH_ */
  • rtemsbsd/freebsd/machine/endian.h

    r89466ac r2f52893  
    88
    99/*
    10  * Copyright (c) 2009, 2010 embedded brains GmbH.  All rights reserved.
     10 * Copyright (c) 2009-2012 embedded brains GmbH.  All rights reserved.
    1111 *
    1212 *  embedded brains GmbH
     
    1616 *  <rtems@embedded-brains.de>
    1717 *
    18  * The license and distribution terms for this file may be
    19  * found in the file LICENSE in this distribution or at
    20  * http://www.rtems.com/license/LICENSE.
     18 * Copyright (c) 1987, 1991, 1993
     19 *      The Regents of the University of California.  All rights reserved.
     20 *
     21 * Redistribution and use in source and binary forms, with or without
     22 * modification, are permitted provided that the following conditions
     23 * are met:
     24 * 1. Redistributions of source code must retain the above copyright
     25 *    notice, this list of conditions and the following disclaimer.
     26 * 2. Redistributions in binary form must reproduce the above copyright
     27 *    notice, this list of conditions and the following disclaimer in the
     28 *    documentation and/or other materials provided with the distribution.
     29 * 4. Neither the name of the University nor the names of its contributors
     30 *    may be used to endorse or promote products derived from this software
     31 *    without specific prior written permission.
     32 *
     33 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
     34 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
     35 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
     36 * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
     37 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
     38 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
     39 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     40 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
     41 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
     42 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
     43 * SUCH DAMAGE.
    2144 */
    2245
     
    4669#define __ntohs(x)  __bswap16(x)
    4770
     71static __inline uint64_t
     72__bswap64(uint64_t _x)
     73{
     74
     75        return ((_x >> 56) | ((_x >> 40) & 0xff00) | ((_x >> 24) & 0xff0000) |
     76            ((_x >> 8) & 0xff000000) | ((_x << 8) & ((uint64_t)0xff << 32)) |
     77            ((_x << 24) & ((uint64_t)0xff << 40)) |
     78            ((_x << 40) & ((uint64_t)0xff << 48)) | ((_x << 56)));
     79}
     80
    4881#endif /* _RTEMS_BSD_MACHINE_ENDIAN_H */
Note: See TracChangeset for help on using the changeset viewer.