Skip to content

Commit

Permalink
Merge pull request #2047 from PX4/nuttx_next_7-9_rand
Browse files Browse the repository at this point in the history
Updated to Nuttx 7.9 (plus) Includes fix for RAND_MAX
  • Loading branch information
David Sidrane committed Apr 20, 2015
2 parents 914cba6 + 4b5ede9 commit 98ac880
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 9 deletions.
2 changes: 1 addition & 1 deletion NuttX
Submodule NuttX updated from 66a565 to 4127e3
8 changes: 4 additions & 4 deletions nuttx-patches/Fixed-Shadow-wanings.patch
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
diff --git NuttX/nuttx/include/signal.h NuttX/nuttx/include/signal.h
index ffb77e0..cca6a15 100644
index 8ef4d5f..f970a49 100644
--- NuttX/nuttx/include/signal.h
+++ NuttX/nuttx/include/signal.h
@@ -260,8 +260,11 @@ int sigfillset(FAR sigset_t *set);
@@ -271,8 +271,11 @@ int sigfillset(FAR sigset_t *set);
int sigaddset(FAR sigset_t *set, int signo);
int sigdelset(FAR sigset_t *set, int signo);
int sigismember(FAR const sigset_t *set, int signo);
Expand All @@ -11,9 +11,9 @@ index ffb77e0..cca6a15 100644
int sigaction(int sig, FAR const struct sigaction *act,
FAR struct sigaction *oact);
+#pragma GCC diagnostic pop
void (*sigset(int signo, void (*disp)(int)))(int);
int sigignore(int signo);
int sigprocmask(int how, FAR const sigset_t *set, FAR sigset_t *oset);
int sigpending(FAR sigset_t *set);
int sigsuspend(FAR const sigset_t *sigmask);
diff --git NuttX/nuttx/include/stdio.h NuttX/nuttx/include/stdio.h
index cb16366..6ff12bb 100644
--- NuttX/nuttx/include/stdio.h
Expand Down
1 change: 0 additions & 1 deletion src/lib/px4_eigen.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@
#pragma once

#pragma GCC diagnostic push
#define RAND_MAX __RAND_MAX
#pragma GCC diagnostic ignored "-Wshadow"
#pragma GCC diagnostic ignored "-Wfloat-equal"
#define _GLIBCXX_USE_C99_FP_MACROS_DYNAMIC 1
Expand Down
6 changes: 3 additions & 3 deletions src/modules/controllib/blocks.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -446,7 +446,7 @@ class __EXPORT BlockRandUniform: public Block
};
virtual ~BlockRandUniform() {};
float update() {
static float rand_max = MAX_RAND;
static float rand_max = RAND_MAX;
float rand_val = rand();
float bounds = getMax() - getMin();
return getMin() + (rand_val * bounds) / rand_max;
Expand Down Expand Up @@ -483,8 +483,8 @@ class __EXPORT BlockRandGauss: public Block

if (phase == 0) {
do {
float U1 = (float)rand() / MAX_RAND;
float U2 = (float)rand() / MAX_RAND;
float U1 = (float)rand() / RAND_MAX;
float U2 = (float)rand() / RAND_MAX;
V1 = 2 * U1 - 1;
V2 = 2 * U2 - 1;
S = V1 * V1 + V2 * V2;
Expand Down

0 comments on commit 98ac880

Please sign in to comment.