Changeset 8e7c9fe in mainline for uspace/lib/math/generic/mod.c


Ignore:
Timestamp:
2014-09-12T03:45:25Z (11 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
c53b58e
Parents:
3eb0c85 (diff), 105d8d6 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

merge mainline changes

most usb changes were reverted. blink and usbmass were fixed
known problems:
ehci won't initialize
usbmast asserts on unmount (happens on mainline too)

File:
1 moved

Legend:

Unmodified
Added
Removed
  • uspace/lib/math/generic/mod.c

    r3eb0c85 r8e7c9fe  
    11/*
    2  * Copyright (c) 2006 Jakub Jermar
     2 * Copyright (c) 2014 Martin Decky
    33 * All rights reserved.
    44 *
     
    2727 */
    2828
    29 /** @addtogroup ppc32ddi
     29/** @addtogroup libmath
    3030 * @{
    3131 */
     
    3333 */
    3434
    35 #include <ddi/ddi.h>
    36 #include <proc/task.h>
    37 #include <typedefs.h>
     35#include <math.h>
     36#include <mod.h>
    3837
    39 /** Enable I/O space range for task.
     38/** Double precision modulo
    4039 *
    41  * Interrupts are disabled and task is locked.
     40 * Calculate the modulo of dividend by divisor.
    4241 *
    43  * @param task Task.
    44  * @param ioaddr Startign I/O space address.
    45  * @param size Size of the enabled I/O range.
     42 * This is a very basic implementation that uses
     43 * division and multiplication (instead of exact
     44 * arithmetics). Thus the result might be very
     45 * imprecise (depending on the magnitude of the
     46 * arguments).
    4647 *
    47  * @return 0 on success or an error code from errno.h.
     48 * @param dividend Dividend.
     49 * @param divisor  Divisor.
     50 *
     51 * @return Modulo.
    4852 *
    4953 */
    50 int ddi_iospace_enable_arch(task_t *task, uintptr_t ioaddr, size_t size)
     54double double_mod(double dividend, double divisor)
    5155{
    52         return 0;
     56        // FIXME: replace with exact arithmetics
     57       
     58        double quotient = trunc(dividend / divisor);
     59       
     60        return (dividend - quotient * divisor);
    5361}
    5462
Note: See TracChangeset for help on using the changeset viewer.