3-phase PV router
Loading...
Searching...
No Matches
FastDivision.h
Go to the documentation of this file.
1
2#ifndef FASTDIVISION_H
3#define FASTDIVISION_H
4
5#include <Arduino.h>
6
7extern unsigned int divu60(unsigned int n) __attribute__((noinline)); //31 cycles
8extern unsigned int divu30(unsigned int n) asm("divu30helper") __attribute__((noinline)); //29 cycles
9extern unsigned int divu24(unsigned int n) __attribute__((noinline)); //33 cycles
10extern unsigned int divu20(unsigned int n) __attribute__((noinline)); //31 cycles
11extern unsigned int divu15(unsigned int n) __attribute__((noinline)); //32 cycles
12extern unsigned int divu14(unsigned int n) __attribute__((noinline)); //41 cycles
13//extern unsigned int divu13(unsigned int n) __attribute__((noinline)); //Can't make this one work, sorry :(
14extern unsigned int divu12(unsigned int n) asm("divu12helper") __attribute__((noinline)); //31 cycles
15extern unsigned int divu11(unsigned int n) __attribute__((noinline)); //41 cycles
16extern unsigned int divu10(unsigned int n) asm("divu10helper") __attribute__((noinline)); //29 cycles
17extern unsigned int divu9(unsigned int n) __attribute__((noinline)); //41 cycles
18#define divu8(n) (unsigned int)((unsigned int)n >> 3) //These are done as #defines as no improvement can be made.
19extern unsigned int divu7(unsigned int n) __attribute__((noinline)); //41 cycles
20extern unsigned int divu6(unsigned int n) asm("divu6helper") __attribute__((noinline)); //29 cycles
21extern unsigned int divu5(unsigned int n) __attribute__((noinline)); //32 cycles
22#define divu4(n) (unsigned int)((unsigned int)n >> 2) //These are done as #defines as no improvement can be made.
23extern unsigned int divu3(unsigned int n) __attribute__((noinline)); //32 cycles
24#define divu2(n) (unsigned int)((unsigned int)n >> 1) //These are done as #defines as no improvement can be made.
25#define divu1(n) (unsigned int)((unsigned int)n) //These are done as #defines as no improvement can be made.
26
27extern void divmod10(uint32_t in, uint32_t &div, uint8_t &mod) __attribute__((noinline));
28
29#endif /* FASTDIVISION_H */
unsigned int divu5(unsigned int n) __attribute__((noinline))
unsigned int divu15(unsigned int n) __attribute__((noinline))
unsigned int divu3(unsigned int n) __attribute__((noinline))
unsigned int divu30(unsigned int n) asm("divu30helper") __attribute__((noinline))
unsigned int divu9(unsigned int n) __attribute__((noinline))
void divmod10(uint32_t in, uint32_t &div, uint8_t &mod) __attribute__((noinline))
unsigned int divu11(unsigned int n) __attribute__((noinline))
unsigned int divu10(unsigned int n) asm("divu10helper") __attribute__((noinline))
Definition: FastDivision.cpp:3
unsigned int divu6(unsigned int n) asm("divu6helper") __attribute__((noinline))
unsigned int divu7(unsigned int n) __attribute__((noinline))
unsigned int divu14(unsigned int n) __attribute__((noinline))
unsigned int divu12(unsigned int n) asm("divu12helper") __attribute__((noinline))
unsigned int divu20(unsigned int n) __attribute__((noinline))
unsigned int divu60(unsigned int n) __attribute__((noinline))
unsigned int divu24(unsigned int n) __attribute__((noinline))