summaryrefslogtreecommitdiffhomepage
path: root/src/numeric.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/numeric.c')
-rw-r--r--src/numeric.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/src/numeric.c b/src/numeric.c
index 91843fdf8..cfde61c8c 100644
--- a/src/numeric.c
+++ b/src/numeric.c
@@ -4,7 +4,6 @@
** See Copyright Notice in mruby.h
*/
-#include <assert.h>
#include <float.h>
#if defined(__FreeBSD__) && __FreeBSD__ < 4
# include <floatingpoint.h>
@@ -240,7 +239,8 @@ mrb_flo_to_str(mrb_state *mrb, mrb_value flo, int max_digit)
*(c++) = 'e';
if (exp > 0) {
*(c++) = '+';
- } else {
+ }
+ else {
*(c++) = '-';
exp = -exp;
}
@@ -781,7 +781,7 @@ fixdivmod(mrb_state *mrb, mrb_int x, mrb_int y, mrb_int *divp, mrb_int *modp)
{
mrb_int div, mod;
- /* TODO: add assert(y != 0) to make sure */
+ /* TODO: add mrb_assert(y != 0) to make sure */
if (y < 0) {
if (x < 0)
@@ -998,7 +998,7 @@ fix_xor(mrb_state *mrb, mrb_value x)
#define NUMERIC_SHIFT_WIDTH_MAX (sizeof(mrb_int)*CHAR_BIT-1)
static mrb_value
-lshift(mrb_state *mrb, mrb_int val, int width)
+lshift(mrb_state *mrb, mrb_int val, size_t width)
{
if (width > NUMERIC_SHIFT_WIDTH_MAX) {
mrb_raisef(mrb, E_RANGE_ERROR, "width(%S) > (%S:sizeof(mrb_int)*CHAR_BIT-1)",
@@ -1010,7 +1010,7 @@ lshift(mrb_state *mrb, mrb_int val, int width)
}
static mrb_value
-rshift(mrb_int val, int width)
+rshift(mrb_int val, size_t width)
{
if (width >= NUMERIC_SHIFT_WIDTH_MAX) {
if (val < 0) {
@@ -1253,12 +1253,14 @@ mrb_fixnum_to_str(mrb_state *mrb, mrb_value x, int base)
if (val == 0) {
*--b = '0';
- } else if (val < 0) {
+ }
+ else if (val < 0) {
do {
*--b = mrb_digitmap[-(val % base)];
} while (val /= base);
*--b = '-';
- } else {
+ }
+ else {
do {
*--b = mrb_digitmap[(int)(val % base)];
} while (val /= base);