1/* 2 * COPYRIGHT: BSD - See COPYING.ARM in the top level directory 3 * PROJECT: ReactOS CRT library 4 * PURPOSE: Implementation of __rt_srsh 5 * PROGRAMMER: Timo Kreuzer (timo.kreuzer@reactos.org) 6 */ 7 8/* INCLUDES ******************************************************************/ 9 10#include <kxarm.h> 11 12/* CODE **********************************************************************/ 13 14 TEXTAREA 15 16/* 17 __int64 18 __rt_srsh( 19 __int64 value, 20 uint32_t shift); 21 22 R0 = loword of value 23 R1 = hiword of value 24 R2 = shift 25 26*/ 27 28 LEAF_ENTRY __rt_srsh 29 30 /* r3 = 32 - r2 */ 31 rsbs r3, r2, #32 32 33 /* Branch if minus (r2 > 32) */ 34 bmi __rt_srsh2 35 36 /* r0 = r0 >> r2 (logical shift!) */ 37 lsr r0, r0, r2 38 39 /* r3 = r1 << r3 */ 40 lsl r3, r1, r3 41 42 /* r0 |= r1 << (32 - r2) */ 43 orr r0, r0, r3 44 45 /* r1 = r1 >> r2 (arithmetic shift!) */ 46 asr r1, r1, r2 47 48 bx lr 49 50__rt_srsh2 51 52 /* Check if shift is > 64 */ 53 cmp r2, 64 54 bhs __rt_srsh3 55 56 /* r3 = r2 - 32 */ 57 sub r3, r2, #32 58 59 /* r0 = r1 >> r3 (arithmetic shift!) */ 60 asr r0, r1, r3 61 62 /* r1 = r1 >> 32 (arithmetic shift!) */ 63 asr r1, r1, #32 64 65 bx lr 66 67__rt_srsh3 68 69 /* r1 = r1 >> 32 (arithmetic shift!) */ 70 asr r1, r1, #32 71 72 /* r0 = r1 */ 73 mov r0, r1 74 75 bx lr 76 77 LEAF_END __rt_srsh 78 79 END 80/* EOF */ 81