* Updated license

* Removed extraneous tabs
* Implemented lldiv (#2688)


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@27250 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Salvatore Benedetto 2008-08-31 10:40:58 +00:00
parent e969748a3d
commit 29fd670a1b
2 changed files with 25 additions and 7 deletions

View File

@ -1,8 +1,9 @@
/*
* Copyright 2002-2005, Haiku Inc. All Rights Reserved.
* Distributed under the terms of the MIT License.
*/
#ifndef _DIV_T_H_
#define _DIV_T_H_
/*
** Distributed under the terms of the OpenBeOS License.
*/
typedef struct {
int quot;

View File

@ -14,10 +14,10 @@ div_t
div(int numerator, int denominator)
{
div_t val;
val.quot = numerator / denominator;
val.rem = numerator - denominator * val.quot;
if (val.rem > 0 && val.quot < 0) {
val.rem -= denominator;
++val.quot;
@ -31,10 +31,27 @@ ldiv_t
ldiv(long numerator, long denominator)
{
ldiv_t val;
val.quot = numerator / denominator;
val.rem = numerator - denominator * val.quot;
if (val.rem > 0 && val.quot < 0) {
val.rem -= denominator;
++val.quot;
}
return val;
}
lldiv_t
lldiv(long long numerator, long long denominator)
{
lldiv_t val;
val.quot = numerator / denominator;
val.rem = numerator - denominator * val.quot;
if (val.rem > 0 && val.quot < 0) {
val.rem -= denominator;
++val.quot;