Skip to content

Commit

Permalink
Add source files
Browse files Browse the repository at this point in the history
  • Loading branch information
rockeet committed Nov 14, 2022
1 parent e6b0efb commit 4e919af
Show file tree
Hide file tree
Showing 21 changed files with 6,544 additions and 0 deletions.
432 changes: 432 additions & 0 deletions Makefile

Large diffs are not rendered by default.

6 changes: 6 additions & 0 deletions cpu_features.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@

if [ `uname` == Darwin ]; then
sysctl -n machdep.cpu.features | tr 'A-Z' 'a-z' | sed -E 's/[[:space:]]+/'$'\\\n/g'
else
cat /proc/cpuinfo | sed -n '/^flags\s*:\s*/s/^[^:]*:\s*//p' | uniq | tr 'A-Z' 'a-z' | sed 's/\s\+/\n/g'
fi
11 changes: 11 additions & 0 deletions cpu_has_bmi2.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@

mydir=`dirname $0`
bash $mydir/cpu_features.sh | grep -qs bmi2
bmi2_status=${PIPESTATUS[1]}
if [ $bmi2_status -eq 0 ] # 0 indicate success
then
echo 1
else
echo 0
fi

36 changes: 36 additions & 0 deletions gen_env_conf.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#!/bin/bash
#set -x

CXX=$1
COMPILER=$2
EnvConf=$3
echo COMPILER=$COMPILER 1>&2

#EnvConf=Make.env.conf-${COMPILER}

rm -f $EnvConf
mkdir -p `dirname $EnvConf`

cat > is_cygwin.cpp << "EOF"
#include <stdio.h>
int main() {
#ifdef __CYGWIN__
printf("1");
#else
printf("0");
#endif
return 0;
}
EOF
if $CXX is_cygwin.cpp -o is_cygwin.exe; then
IS_CYGWIN=`./is_cygwin.exe`
echo IS_CYGWIN=$IS_CYGWIN >> $EnvConf
fi
rm -f is_cygwin.*

if [ "$IS_CYGWIN" -eq 1 ]; then
rm -f a.exe
else
rm -f a.out
fi

Loading

0 comments on commit 4e919af

Please sign in to comment.