Skip to content

Commit

Permalink
Merge branch 'master' of github.com:JuliaLang/julia
Browse files Browse the repository at this point in the history
* 'master' of github.com:JuliaLang/julia:
  Some fixes for building on OS X 10.7. Disable shared library build of readline. We use the static version anyways. Add s_signbit.c to fdlibm - a bit of a kludge
  • Loading branch information
StefanKarpinski committed Jul 21, 2011
2 parents 0f9bb68 + 7efe85f commit 577814c
Show file tree
Hide file tree
Showing 3 changed files with 85 additions and 2 deletions.
2 changes: 1 addition & 1 deletion external/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ readline-$(READLINE_VER)/configure: readline-$(READLINE_VER).tar.gz
touch $@
$(READLINE_OBJ_SOURCE): readline-$(READLINE_VER)/configure
cd readline-$(READLINE_VER) && \
./configure --prefix=$(EXTROOT) && \
./configure --prefix=$(EXTROOT) --disable-shared --enable-static --with-curses && \
make
touch $@
$(READLINE_OBJ_TARGET): $(READLINE_OBJ_SOURCE)
Expand Down
3 changes: 2 additions & 1 deletion external/fdlibm/makefile
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,8 @@ src = k_standard.c k_rem_pio2.c \
e_log10f.c s_cbrtf.c s_log1pf.c w_dremf.c \
e_log2f.c s_ceilf.c s_logbf.c w_gammaf.c \
e_logf.c s_copysignf.c w_lgammaf.c s_finitef.c \
e_lgammaf_r.c b_exp.c b_log.c b_tgamma.c
e_lgammaf_r.c b_exp.c b_log.c b_tgamma.c \
s_signbit.c

obj = $(src:%.c=%.o)

Expand Down
82 changes: 82 additions & 0 deletions external/fdlibm/s_signbit.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
/*-
* Copyright (c) 2003 Mike Barcroft <mike@FreeBSD.org>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $FreeBSD: src/lib/msun/src/s_signbit.c,v 1.1.30.1.6.1 2010/12/21 17:09:25 kensmith Exp $
*/

#include "fdlibm.h"

union IEEEf2bits {
float f;
struct {
#if _BYTE_ORDER == _LITTLE_ENDIAN
unsigned int man :23;
unsigned int exp :8;
unsigned int sign :1;
#else /* _BIG_ENDIAN */
unsigned int sign :1;
unsigned int exp :8;
unsigned int man :23;
#endif
} bits;
};

#define DBL_MANH_SIZE 20
#define DBL_MANL_SIZE 32

union IEEEd2bits {
double d;
struct {
#if _BYTE_ORDER == _LITTLE_ENDIAN
unsigned int manl :32;
unsigned int manh :20;
unsigned int exp :11;
unsigned int sign :1;
#else /* _BIG_ENDIAN */
unsigned int sign :1;
unsigned int exp :11;
unsigned int manh :20;
unsigned int manl :32;
#endif
} bits;
};

int
signbit(double d)
{
union IEEEd2bits u;

u.d = d;
return (u.bits.sign);
}

int
signbitf(float f)
{
union IEEEf2bits u;

u.f = f;
return (u.bits.sign);
}

0 comments on commit 577814c

Please sign in to comment.