Wire Sysio Wire Sysion 1.0.0
Loading...
Searching...
No Matches
s_shiftRightJam256M.c
Go to the documentation of this file.
1
2/*============================================================================
3
4This C source file is part of the SoftFloat IEEE Floating-Point Arithmetic
5Package, Release 3e, by John R. Hauser.
6
7Copyright 2011, 2012, 2013, 2014, 2015, 2016 The Regents of the University of
8California. All rights reserved.
9
10Redistribution and use in source and binary forms, with or without
11modification, are permitted provided that the following conditions are met:
12
13 1. Redistributions of source code must retain the above copyright notice,
14 this list of conditions, and the following disclaimer.
15
16 2. Redistributions in binary form must reproduce the above copyright notice,
17 this list of conditions, and the following disclaimer in the documentation
18 and/or other materials provided with the distribution.
19
20 3. Neither the name of the University nor the names of its contributors may
21 be used to endorse or promote products derived from this software without
22 specific prior written permission.
23
24THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS "AS IS", AND ANY
25EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
26WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ARE
27DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY
28DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
29(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
30LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
31ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
32(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
33SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34
35=============================================================================*/
36
37#include <stdint.h>
38#include "platform.h"
39#include "primitiveTypes.h"
40
41#ifndef softfloat_shiftRightJam256M
42
43static
44 void
46 uint_fast8_t size_words,
47 const uint64_t *aPtr,
48 uint_fast8_t dist,
49 uint64_t *zPtr
50 )
51{
52 uint_fast8_t uNegDist;
53 unsigned int index, lastIndex;
54 uint64_t partWordZ, wordA;
55
56 uNegDist = -dist;
57 index = indexWordLo( size_words );
58 lastIndex = indexWordHi( size_words );
59 wordA = aPtr[index];
60 partWordZ = wordA>>dist;
61 if ( partWordZ<<dist != wordA ) partWordZ |= 1;
62 while ( index != lastIndex ) {
63 wordA = aPtr[index + wordIncr];
64 zPtr[index] = wordA<<(uNegDist & 63) | partWordZ;
65 index += wordIncr;
66 partWordZ = wordA>>dist;
67 }
68 zPtr[index] = partWordZ;
69
70}
71
72void
74 const uint64_t *aPtr, uint_fast32_t dist, uint64_t *zPtr )
75{
76 uint64_t wordJam;
77 uint_fast32_t wordDist;
78 uint64_t *ptr;
79 uint_fast8_t i, innerDist;
80
81 wordJam = 0;
82 wordDist = dist>>6;
83 if ( wordDist ) {
84 if ( 4 < wordDist ) wordDist = 4;
85 ptr = (uint64_t *) (aPtr + indexMultiwordLo( 4, wordDist ));
86 i = wordDist;
87 do {
88 wordJam = *ptr++;
89 if ( wordJam ) break;
90 --i;
91 } while ( i );
92 ptr = zPtr;
93 }
94 if ( wordDist < 4 ) {
95 aPtr += indexMultiwordHiBut( 4, wordDist );
96 innerDist = dist & 63;
97 if ( innerDist ) {
99 4 - wordDist,
100 aPtr,
101 innerDist,
102 zPtr + indexMultiwordLoBut( 4, wordDist )
103 );
104 if ( ! wordDist ) goto wordJam;
105 } else {
106 aPtr += indexWordLo( 4 - wordDist );
107 ptr = zPtr + indexWordLo( 4 );
108 for ( i = 4 - wordDist; i; --i ) {
109 *ptr = *aPtr;
110 aPtr += wordIncr;
111 ptr += wordIncr;
112 }
113 }
114 ptr = zPtr + indexMultiwordHi( 4, wordDist );
115 }
116 do {
117 *ptr++ = 0;
118 --wordDist;
119 } while ( wordDist );
120 wordJam:
121 if ( wordJam ) zPtr[indexWordLo( 4 )] |= 1;
122
123}
124
125#endif
126
#define indexMultiwordHi(total, n)
#define indexMultiwordLo(total, n)
#define wordIncr
#define indexWordLo(total)
#define indexMultiwordHiBut(total, n)
#define indexWordHi(total)
#define indexMultiwordLoBut(total, n)
void softfloat_shortShiftRightJamM(uint_fast8_t, const uint32_t *, uint_fast8_t, uint32_t *)
void softfloat_shiftRightJam256M(const uint64_t *aPtr, uint_fast32_t dist, uint64_t *zPtr)
uint32_t uint_fast32_t
Definition stdint.h:156
uint8_t uint_fast8_t
Definition stdint.h:154
unsigned __int64 uint64_t
Definition stdint.h:136