summaryrefslogtreecommitdiff
path: root/apps/plugins/lib
diff options
context:
space:
mode:
Diffstat (limited to 'apps/plugins/lib')
-rw-r--r--apps/plugins/lib/fixedpoint.c3
-rw-r--r--apps/plugins/lib/grey_core.c2
-rw-r--r--apps/plugins/lib/helper.c14
3 files changed, 17 insertions, 2 deletions
diff --git a/apps/plugins/lib/fixedpoint.c b/apps/plugins/lib/fixedpoint.c
index 7b9b68a1e8..0ae2cded69 100644
--- a/apps/plugins/lib/fixedpoint.c
+++ b/apps/plugins/lib/fixedpoint.c
@@ -22,6 +22,7 @@
22 ****************************************************************************/ 22 ****************************************************************************/
23 23
24#include <inttypes.h> 24#include <inttypes.h>
25#include "plugin.h"
25#include "fixedpoint.h" 26#include "fixedpoint.h"
26 27
27/* Inverse gain of circular cordic rotation in s0.31 format. */ 28/* Inverse gain of circular cordic rotation in s0.31 format. */
@@ -144,7 +145,7 @@ long fsincos(unsigned long phase, long *cos)
144 */ 145 */
145long fsqrt(long a, unsigned int fracbits) 146long fsqrt(long a, unsigned int fracbits)
146{ 147{
147 long b = a/2 + (1 << fracbits); /* initial approximation */ 148 long b = a/2 + BIT_N(fracbits); /* initial approximation */
148 unsigned n; 149 unsigned n;
149 const unsigned iterations = 4; 150 const unsigned iterations = 4;
150 151
diff --git a/apps/plugins/lib/grey_core.c b/apps/plugins/lib/grey_core.c
index 18b2716d4d..ea70ae942b 100644
--- a/apps/plugins/lib/grey_core.c
+++ b/apps/plugins/lib/grey_core.c
@@ -860,7 +860,7 @@ static void grey_screendump_hook(int fd)
860 + _GREY_MULUQ(_grey_info.width, gy & ~_GREY_BMASK); 860 + _GREY_MULUQ(_grey_info.width, gy & ~_GREY_BMASK);
861 861
862#if LCD_DEPTH == 1 862#if LCD_DEPTH == 1
863 mask = 1 << (y & 7); 863 mask = BIT_N(y & 7);
864 src = rb->lcd_framebuffer + _GREY_MULUQ(LCD_WIDTH, y >> 3); 864 src = rb->lcd_framebuffer + _GREY_MULUQ(LCD_WIDTH, y >> 3);
865 865
866 do 866 do
diff --git a/apps/plugins/lib/helper.c b/apps/plugins/lib/helper.c
index e35e43a40a..b95ee7ab35 100644
--- a/apps/plugins/lib/helper.c
+++ b/apps/plugins/lib/helper.c
@@ -22,6 +22,20 @@
22#include "plugin.h" 22#include "plugin.h"
23#include "helper.h" 23#include "helper.h"
24 24
25#ifdef CPU_SH
26/* Lookup table for using the BIT_N() macro in plugins */
27const unsigned bit_n_table[32] = {
28 1LU<< 0, 1LU<< 1, 1LU<< 2, 1LU<< 3,
29 1LU<< 4, 1LU<< 5, 1LU<< 6, 1LU<< 7,
30 1LU<< 8, 1LU<< 9, 1LU<<10, 1LU<<11,
31 1LU<<12, 1LU<<13, 1LU<<14, 1LU<<15,
32 1LU<<16, 1LU<<17, 1LU<<18, 1LU<<19,
33 1LU<<20, 1LU<<21, 1LU<<22, 1LU<<23,
34 1LU<<24, 1LU<<25, 1LU<<26, 1LU<<27,
35 1LU<<28, 1LU<<29, 1LU<<30, 1LU<<31
36};
37#endif
38
25/* Force the backlight on */ 39/* Force the backlight on */
26void backlight_force_on(void) 40void backlight_force_on(void)
27{ 41{