1/* Miscellaneous BPABI functions. 2 3 Copyright (C) 2003, 2004 Free Software Foundation, Inc. 4 Contributed by CodeSourcery, LLC. 5 6 This file is free software; you can redistribute it and/or modify it 7 under the terms of the GNU General Public License as published by the 8 Free Software Foundation; either version 2, or (at your option) any 9 later version. 10 11 In addition to the permissions in the GNU General Public License, the 12 Free Software Foundation gives you unlimited permission to link the 13 compiled version of this file into combinations with other programs, 14 and to distribute those combinations without any restriction coming 15 from the use of this file. (The General Public License restrictions 16 do apply in other respects; for example, they cover modification of 17 the file, and distribution when not linked into a combine 18 executable.) 19 20 This file is distributed in the hope that it will be useful, but 21 WITHOUT ANY WARRANTY; without even the implied warranty of 22 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 23 General Public License for more details. 24 25 You should have received a copy of the GNU General Public License 26 along with this program; see the file COPYING. If not, write to 27 the Free Software Foundation, 51 Franklin Street, Fifth Floor, 28 Boston, MA 02110-1301, USA. */ 29 30extern long long __divdi3 (long long, long long); 31extern unsigned long long __udivdi3 (unsigned long long, 32 unsigned long long); 33extern long long __gnu_ldivmod_helper (long long, long long, long long *); 34extern unsigned long long __gnu_uldivmod_helper (unsigned long long, 35 unsigned long long, 36 unsigned long long *); 37 38 39long long 40__gnu_ldivmod_helper (long long a, 41 long long b, 42 long long *remainder) 43{ 44 long long quotient; 45 46 quotient = __divdi3 (a, b); 47 *remainder = a - b * quotient; 48 return quotient; 49} 50 51unsigned long long 52__gnu_uldivmod_helper (unsigned long long a, 53 unsigned long long b, 54 unsigned long long *remainder) 55{ 56 unsigned long long quotient; 57 58 quotient = __udivdi3 (a, b); 59 *remainder = a - b * quotient; 60 return quotient; 61} 62