1*04e0dc4aSTimo Kreuzer // 2*04e0dc4aSTimo Kreuzer // div.cpp 3*04e0dc4aSTimo Kreuzer // 4*04e0dc4aSTimo Kreuzer // Copyright (c) Microsoft Corporation. All rights reserved. 5*04e0dc4aSTimo Kreuzer // 6*04e0dc4aSTimo Kreuzer // Defines div(), which performs a signed divide and returns the quotient and 7*04e0dc4aSTimo Kreuzer // remainder. No validation of the arguments is done. 8*04e0dc4aSTimo Kreuzer // 9*04e0dc4aSTimo Kreuzer #include <stdlib.h> 10*04e0dc4aSTimo Kreuzer 11*04e0dc4aSTimo Kreuzer 12*04e0dc4aSTimo Kreuzer #ifdef _MSC_VER 13*04e0dc4aSTimo Kreuzer #pragma function(div) 14*04e0dc4aSTimo Kreuzer #endif div(int const numerator,int const denominator)15*04e0dc4aSTimo Kreuzerextern "C" div_t __cdecl div(int const numerator, int const denominator) 16*04e0dc4aSTimo Kreuzer { 17*04e0dc4aSTimo Kreuzer div_t result; 18*04e0dc4aSTimo Kreuzer 19*04e0dc4aSTimo Kreuzer result.quot = numerator / denominator; 20*04e0dc4aSTimo Kreuzer result.rem = numerator % denominator; 21*04e0dc4aSTimo Kreuzer 22*04e0dc4aSTimo Kreuzer return result; 23*04e0dc4aSTimo Kreuzer } 24