Deleted Added
full compact
utmath.c (85756) utmath.c (87031)
1/*******************************************************************************
2 *
3 * Module Name: utmath - Integer math support routines
1/*******************************************************************************
2 *
3 * Module Name: utmath - Integer math support routines
4 * $Revision: 7 $
4 * $Revision: 8 $
5 *
6 ******************************************************************************/
7
8/******************************************************************************
9 *
10 * 1. Copyright Notice
11 *
12 * Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.

--- 111 unchanged lines hidden (view full) ---

124 MODULE_NAME ("utmath")
125
126/*
127 * Support for double-precision integer divide. This code is included here
128 * in order to support kernel environments where the double-precision math
129 * library is not available.
130 */
131
5 *
6 ******************************************************************************/
7
8/******************************************************************************
9 *
10 * 1. Copyright Notice
11 *
12 * Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.

--- 111 unchanged lines hidden (view full) ---

124 MODULE_NAME ("utmath")
125
126/*
127 * Support for double-precision integer divide. This code is included here
128 * in order to support kernel environments where the double-precision math
129 * library is not available.
130 */
131
132#ifndef ACPI_USE_NATIVE_DIVIDE
132#ifndef ACPI_USE_NATIVE_DIVIDE
133/*******************************************************************************
134 *
135 * FUNCTION: AcpiUtShortDivide
136 *
137 * PARAMETERS: InDividend - Pointer to the dividend
138 * Divisor - 32-bit divisor
139 * OutQuotient - Pointer to where the quotient is returned
140 * OutRemainder - Pointer to where the remainder is returned

--- 29 unchanged lines hidden (view full) ---

170 REPORT_ERROR (("AcpiUtShortDivide: Divide by zero\n"));
171 return_ACPI_STATUS (AE_AML_DIVIDE_BY_ZERO);
172 }
173
174 /*
175 * The quotient is 64 bits, the remainder is always 32 bits,
176 * and is generated by the second divide.
177 */
133/*******************************************************************************
134 *
135 * FUNCTION: AcpiUtShortDivide
136 *
137 * PARAMETERS: InDividend - Pointer to the dividend
138 * Divisor - 32-bit divisor
139 * OutQuotient - Pointer to where the quotient is returned
140 * OutRemainder - Pointer to where the remainder is returned

--- 29 unchanged lines hidden (view full) ---

170 REPORT_ERROR (("AcpiUtShortDivide: Divide by zero\n"));
171 return_ACPI_STATUS (AE_AML_DIVIDE_BY_ZERO);
172 }
173
174 /*
175 * The quotient is 64 bits, the remainder is always 32 bits,
176 * and is generated by the second divide.
177 */
178 ACPI_DIV_64_BY_32 (0, Dividend.Part.Hi, Divisor,
178 ACPI_DIV_64_BY_32 (0, Dividend.Part.Hi, Divisor,
179 Quotient.Part.Hi, Remainder32);
179 Quotient.Part.Hi, Remainder32);
180 ACPI_DIV_64_BY_32 (Remainder32, Dividend.Part.Lo, Divisor,
180 ACPI_DIV_64_BY_32 (Remainder32, Dividend.Part.Lo, Divisor,
181 Quotient.Part.Lo, Remainder32);
182
183 /* Return only what was requested */
184
185 if (OutQuotient)
186 {
187 *OutQuotient = Quotient.Full;
188 }

--- 59 unchanged lines hidden (view full) ---

248 * just do two divides
249 */
250 Remainder.Part.Hi = 0;
251
252 /*
253 * The quotient is 64 bits, the remainder is always 32 bits,
254 * and is generated by the second divide.
255 */
181 Quotient.Part.Lo, Remainder32);
182
183 /* Return only what was requested */
184
185 if (OutQuotient)
186 {
187 *OutQuotient = Quotient.Full;
188 }

--- 59 unchanged lines hidden (view full) ---

248 * just do two divides
249 */
250 Remainder.Part.Hi = 0;
251
252 /*
253 * The quotient is 64 bits, the remainder is always 32 bits,
254 * and is generated by the second divide.
255 */
256 ACPI_DIV_64_BY_32 (0, Dividend.Part.Hi, Divisor.Part.Lo,
256 ACPI_DIV_64_BY_32 (0, Dividend.Part.Hi, Divisor.Part.Lo,
257 Quotient.Part.Hi, Partial1);
257 Quotient.Part.Hi, Partial1);
258 ACPI_DIV_64_BY_32 (Partial1, Dividend.Part.Lo, Divisor.Part.Lo,
258 ACPI_DIV_64_BY_32 (Partial1, Dividend.Part.Lo, Divisor.Part.Lo,
259 Quotient.Part.Lo, Remainder.Part.Lo);
260 }
261
262 else
263 {
264 /*
265 * 2) The general case where the divisor is a full 64 bits
266 * is more difficult
267 */
268 Quotient.Part.Hi = 0;
269 NormalizedDividend = Dividend;
270 NormalizedDivisor = Divisor;
271
272 /* Normalize the operands (shift until the divisor is < 32 bits) */
273
274 do
275 {
259 Quotient.Part.Lo, Remainder.Part.Lo);
260 }
261
262 else
263 {
264 /*
265 * 2) The general case where the divisor is a full 64 bits
266 * is more difficult
267 */
268 Quotient.Part.Hi = 0;
269 NormalizedDividend = Dividend;
270 NormalizedDivisor = Divisor;
271
272 /* Normalize the operands (shift until the divisor is < 32 bits) */
273
274 do
275 {
276 ACPI_SHIFT_RIGHT_64 (NormalizedDivisor.Part.Hi,
276 ACPI_SHIFT_RIGHT_64 (NormalizedDivisor.Part.Hi,
277 NormalizedDivisor.Part.Lo);
277 NormalizedDivisor.Part.Lo);
278 ACPI_SHIFT_RIGHT_64 (NormalizedDividend.Part.Hi,
278 ACPI_SHIFT_RIGHT_64 (NormalizedDividend.Part.Hi,
279 NormalizedDividend.Part.Lo);
280
281 } while (NormalizedDivisor.Part.Hi != 0);
282
283 /* Partial divide */
284
279 NormalizedDividend.Part.Lo);
280
281 } while (NormalizedDivisor.Part.Hi != 0);
282
283 /* Partial divide */
284
285 ACPI_DIV_64_BY_32 (NormalizedDividend.Part.Hi,
286 NormalizedDividend.Part.Lo,
287 NormalizedDivisor.Part.Lo,
285 ACPI_DIV_64_BY_32 (NormalizedDividend.Part.Hi,
286 NormalizedDividend.Part.Lo,
287 NormalizedDivisor.Part.Lo,
288 Quotient.Part.Lo, Partial1);
289
290 /*
291 * The quotient is always 32 bits, and simply requires adjustment.
292 * The 64-bit remainder must be generated.
293 */
294 Partial1 = Quotient.Part.Lo * Divisor.Part.Hi;
295 Partial2.Full = (ACPI_INTEGER) Quotient.Part.Lo * Divisor.Part.Lo;

--- 50 unchanged lines hidden (view full) ---

346
347/*******************************************************************************
348 *
349 * FUNCTION: AcpiUtShortDivide, AcpiUtDivide
350 *
351 * DESCRIPTION: Native versions of the UtDivide functions. Use these if either
352 * 1) The target is a 64-bit platform and therefore 64-bit
353 * integer math is supported directly by the machine.
288 Quotient.Part.Lo, Partial1);
289
290 /*
291 * The quotient is always 32 bits, and simply requires adjustment.
292 * The 64-bit remainder must be generated.
293 */
294 Partial1 = Quotient.Part.Lo * Divisor.Part.Hi;
295 Partial2.Full = (ACPI_INTEGER) Quotient.Part.Lo * Divisor.Part.Lo;

--- 50 unchanged lines hidden (view full) ---

346
347/*******************************************************************************
348 *
349 * FUNCTION: AcpiUtShortDivide, AcpiUtDivide
350 *
351 * DESCRIPTION: Native versions of the UtDivide functions. Use these if either
352 * 1) The target is a 64-bit platform and therefore 64-bit
353 * integer math is supported directly by the machine.
354 * 2) The target is a 32-bit or 16-bit platform, and the
355 * double-precision integer math library is available to
354 * 2) The target is a 32-bit or 16-bit platform, and the
355 * double-precision integer math library is available to
356 * perform the divide.
357 *
358 ******************************************************************************/
359
360ACPI_STATUS
361AcpiUtShortDivide (
362 ACPI_INTEGER *InDividend,
363 UINT32 Divisor,

--- 65 unchanged lines hidden ---
356 * perform the divide.
357 *
358 ******************************************************************************/
359
360ACPI_STATUS
361AcpiUtShortDivide (
362 ACPI_INTEGER *InDividend,
363 UINT32 Divisor,

--- 65 unchanged lines hidden ---