From 0296cf3166e7250191f0e08907b65dad9e665e46 Mon Sep 17 00:00:00 2001 From: imushir Date: Fri, 22 Jan 2016 16:01:46 +0530 Subject: added support of uint8,uint16 for bitwise operators --- .../src/c/elementaryFunctions/bitand/u16bitanda.c | 14 ++++++++ .../src/c/elementaryFunctions/bitand/u16bitands.c | 9 +++++ 2.3-1/src/c/elementaryFunctions/bitand/u8bitanda.c | 14 ++++++++ 2.3-1/src/c/elementaryFunctions/bitand/u8bitands.c | 9 +++++ .../src/c/elementaryFunctions/bitcmp/u16bitcmpa.c | 16 +++++++++ .../src/c/elementaryFunctions/bitcmp/u16bitcmps.c | 11 ++++++ 2.3-1/src/c/elementaryFunctions/bitcmp/u8bitcmpa.c | 16 +++++++++ 2.3-1/src/c/elementaryFunctions/bitcmp/u8bitcmps.c | 11 ++++++ .../src/c/elementaryFunctions/bitget/u16bitgets.c | 24 +++++++++++++ .../src/c/elementaryFunctions/bitget/u16bitgets.c~ | 24 +++++++++++++ 2.3-1/src/c/elementaryFunctions/bitget/u8bitgets.c | 24 +++++++++++++ .../src/c/elementaryFunctions/bitget/u8bitgets.c~ | 24 +++++++++++++ 2.3-1/src/c/elementaryFunctions/bitor/dbitanda.c~ | 14 ++++++++ 2.3-1/src/c/elementaryFunctions/bitor/dbitands.c~ | 9 +++++ .../src/c/elementaryFunctions/bitor/u16bitanda.c~ | 14 ++++++++ .../src/c/elementaryFunctions/bitor/u16bitands.c~ | 9 +++++ 2.3-1/src/c/elementaryFunctions/bitor/u16bitora.c | 14 ++++++++ 2.3-1/src/c/elementaryFunctions/bitor/u16bitora.c~ | 14 ++++++++ 2.3-1/src/c/elementaryFunctions/bitor/u16bitors.c | 9 +++++ 2.3-1/src/c/elementaryFunctions/bitor/u16bitors.c~ | 9 +++++ 2.3-1/src/c/elementaryFunctions/bitor/u8bitanda.c~ | 14 ++++++++ 2.3-1/src/c/elementaryFunctions/bitor/u8bitands.c~ | 9 +++++ 2.3-1/src/c/elementaryFunctions/bitor/u8bitora.c | 14 ++++++++ 2.3-1/src/c/elementaryFunctions/bitor/u8bitora.c~ | 14 ++++++++ 2.3-1/src/c/elementaryFunctions/bitor/u8bitors.c | 9 +++++ 2.3-1/src/c/elementaryFunctions/bitor/u8bitors.c~ | 9 +++++ .../src/c/elementaryFunctions/bitset/u16bitsets.c | 20 +++++++++++ .../src/c/elementaryFunctions/bitset/u16bitsets.c~ | 20 +++++++++++ 2.3-1/src/c/elementaryFunctions/bitset/u8bitsets.c | 20 +++++++++++ .../src/c/elementaryFunctions/bitset/u8bitsets.c~ | 20 +++++++++++ 2.3-1/src/c/elementaryFunctions/bitxor/dbitanda.c~ | 14 ++++++++ 2.3-1/src/c/elementaryFunctions/bitxor/dbitands.c~ | 9 +++++ .../src/c/elementaryFunctions/bitxor/u16bitanda.c~ | 14 ++++++++ .../src/c/elementaryFunctions/bitxor/u16bitands.c~ | 9 +++++ .../src/c/elementaryFunctions/bitxor/u16bitora.c~ | 14 ++++++++ .../src/c/elementaryFunctions/bitxor/u16bitors.c~ | 9 +++++ .../src/c/elementaryFunctions/bitxor/u16bitxora.c | 14 ++++++++ .../src/c/elementaryFunctions/bitxor/u16bitxora.c~ | 14 ++++++++ .../src/c/elementaryFunctions/bitxor/u16bitxors.c | 9 +++++ .../src/c/elementaryFunctions/bitxor/u16bitxors.c~ | 9 +++++ .../src/c/elementaryFunctions/bitxor/u8bitanda.c~ | 14 ++++++++ .../src/c/elementaryFunctions/bitxor/u8bitands.c~ | 9 +++++ 2.3-1/src/c/elementaryFunctions/bitxor/u8bitora.c~ | 14 ++++++++ 2.3-1/src/c/elementaryFunctions/bitxor/u8bitors.c~ | 9 +++++ 2.3-1/src/c/elementaryFunctions/bitxor/u8bitxora.c | 14 ++++++++ .../src/c/elementaryFunctions/bitxor/u8bitxora.c~ | 14 ++++++++ 2.3-1/src/c/elementaryFunctions/bitxor/u8bitxors.c | 9 +++++ .../src/c/elementaryFunctions/bitxor/u8bitxors.c~ | 9 +++++ 2.3-1/src/c/elementaryFunctions/includes/bitand.h | 39 ++++++++++++++++++++++ 2.3-1/src/c/elementaryFunctions/includes/bitcmp.h | 38 +++++++++++++++++++++ 2.3-1/src/c/elementaryFunctions/includes/bitget.h | 25 ++++++++++++++ 2.3-1/src/c/elementaryFunctions/includes/bitor.h | 38 +++++++++++++++++++++ 2.3-1/src/c/elementaryFunctions/includes/bitset.h | 25 ++++++++++++++ 2.3-1/src/c/elementaryFunctions/includes/bitxor.h | 38 +++++++++++++++++++++ .../c/elementaryFunctions/interfaces/int_bitand.h | 16 +++++++++ .../c/elementaryFunctions/interfaces/int_bitcmp.h | 16 +++++++++ .../c/elementaryFunctions/interfaces/int_bitget.h | 10 ++++++ .../c/elementaryFunctions/interfaces/int_bitor.h | 16 +++++++++ .../c/elementaryFunctions/interfaces/int_bitset.h | 13 ++++++++ .../c/elementaryFunctions/interfaces/int_bitxor.h | 16 +++++++++ 60 files changed, 934 insertions(+) create mode 100644 2.3-1/src/c/elementaryFunctions/bitand/u16bitanda.c create mode 100644 2.3-1/src/c/elementaryFunctions/bitand/u16bitands.c create mode 100644 2.3-1/src/c/elementaryFunctions/bitand/u8bitanda.c create mode 100644 2.3-1/src/c/elementaryFunctions/bitand/u8bitands.c create mode 100644 2.3-1/src/c/elementaryFunctions/bitcmp/u16bitcmpa.c create mode 100644 2.3-1/src/c/elementaryFunctions/bitcmp/u16bitcmps.c create mode 100644 2.3-1/src/c/elementaryFunctions/bitcmp/u8bitcmpa.c create mode 100644 2.3-1/src/c/elementaryFunctions/bitcmp/u8bitcmps.c create mode 100644 2.3-1/src/c/elementaryFunctions/bitget/u16bitgets.c create mode 100644 2.3-1/src/c/elementaryFunctions/bitget/u16bitgets.c~ create mode 100644 2.3-1/src/c/elementaryFunctions/bitget/u8bitgets.c create mode 100644 2.3-1/src/c/elementaryFunctions/bitget/u8bitgets.c~ create mode 100644 2.3-1/src/c/elementaryFunctions/bitor/dbitanda.c~ create mode 100644 2.3-1/src/c/elementaryFunctions/bitor/dbitands.c~ create mode 100644 2.3-1/src/c/elementaryFunctions/bitor/u16bitanda.c~ create mode 100644 2.3-1/src/c/elementaryFunctions/bitor/u16bitands.c~ create mode 100644 2.3-1/src/c/elementaryFunctions/bitor/u16bitora.c create mode 100644 2.3-1/src/c/elementaryFunctions/bitor/u16bitora.c~ create mode 100644 2.3-1/src/c/elementaryFunctions/bitor/u16bitors.c create mode 100644 2.3-1/src/c/elementaryFunctions/bitor/u16bitors.c~ create mode 100644 2.3-1/src/c/elementaryFunctions/bitor/u8bitanda.c~ create mode 100644 2.3-1/src/c/elementaryFunctions/bitor/u8bitands.c~ create mode 100644 2.3-1/src/c/elementaryFunctions/bitor/u8bitora.c create mode 100644 2.3-1/src/c/elementaryFunctions/bitor/u8bitora.c~ create mode 100644 2.3-1/src/c/elementaryFunctions/bitor/u8bitors.c create mode 100644 2.3-1/src/c/elementaryFunctions/bitor/u8bitors.c~ create mode 100644 2.3-1/src/c/elementaryFunctions/bitset/u16bitsets.c create mode 100644 2.3-1/src/c/elementaryFunctions/bitset/u16bitsets.c~ create mode 100644 2.3-1/src/c/elementaryFunctions/bitset/u8bitsets.c create mode 100644 2.3-1/src/c/elementaryFunctions/bitset/u8bitsets.c~ create mode 100644 2.3-1/src/c/elementaryFunctions/bitxor/dbitanda.c~ create mode 100644 2.3-1/src/c/elementaryFunctions/bitxor/dbitands.c~ create mode 100644 2.3-1/src/c/elementaryFunctions/bitxor/u16bitanda.c~ create mode 100644 2.3-1/src/c/elementaryFunctions/bitxor/u16bitands.c~ create mode 100644 2.3-1/src/c/elementaryFunctions/bitxor/u16bitora.c~ create mode 100644 2.3-1/src/c/elementaryFunctions/bitxor/u16bitors.c~ create mode 100644 2.3-1/src/c/elementaryFunctions/bitxor/u16bitxora.c create mode 100644 2.3-1/src/c/elementaryFunctions/bitxor/u16bitxora.c~ create mode 100644 2.3-1/src/c/elementaryFunctions/bitxor/u16bitxors.c create mode 100644 2.3-1/src/c/elementaryFunctions/bitxor/u16bitxors.c~ create mode 100644 2.3-1/src/c/elementaryFunctions/bitxor/u8bitanda.c~ create mode 100644 2.3-1/src/c/elementaryFunctions/bitxor/u8bitands.c~ create mode 100644 2.3-1/src/c/elementaryFunctions/bitxor/u8bitora.c~ create mode 100644 2.3-1/src/c/elementaryFunctions/bitxor/u8bitors.c~ create mode 100644 2.3-1/src/c/elementaryFunctions/bitxor/u8bitxora.c create mode 100644 2.3-1/src/c/elementaryFunctions/bitxor/u8bitxora.c~ create mode 100644 2.3-1/src/c/elementaryFunctions/bitxor/u8bitxors.c create mode 100644 2.3-1/src/c/elementaryFunctions/bitxor/u8bitxors.c~ create mode 100644 2.3-1/src/c/elementaryFunctions/includes/bitand.h create mode 100644 2.3-1/src/c/elementaryFunctions/includes/bitcmp.h create mode 100644 2.3-1/src/c/elementaryFunctions/includes/bitget.h create mode 100644 2.3-1/src/c/elementaryFunctions/includes/bitor.h create mode 100644 2.3-1/src/c/elementaryFunctions/includes/bitset.h create mode 100644 2.3-1/src/c/elementaryFunctions/includes/bitxor.h create mode 100644 2.3-1/src/c/elementaryFunctions/interfaces/int_bitand.h create mode 100644 2.3-1/src/c/elementaryFunctions/interfaces/int_bitcmp.h create mode 100644 2.3-1/src/c/elementaryFunctions/interfaces/int_bitget.h create mode 100644 2.3-1/src/c/elementaryFunctions/interfaces/int_bitor.h create mode 100644 2.3-1/src/c/elementaryFunctions/interfaces/int_bitset.h create mode 100644 2.3-1/src/c/elementaryFunctions/interfaces/int_bitxor.h (limited to '2.3-1/src') diff --git a/2.3-1/src/c/elementaryFunctions/bitand/u16bitanda.c b/2.3-1/src/c/elementaryFunctions/bitand/u16bitanda.c new file mode 100644 index 00000000..743161ea --- /dev/null +++ b/2.3-1/src/c/elementaryFunctions/bitand/u16bitanda.c @@ -0,0 +1,14 @@ +/* Scilab2C FOSSEE IITB */ +#include "bitand.h" + +void u16bitanda(uint16* x,uint16* y,int size,uint16* out) +{ + int i = 0; + for(i=0;i + +uint16 u16bitgets(uint16 value,int position) +{ + + value = value >> (position -1); + value = value & 1; + return value; + + /*unsigned char mask = 1<<(position-1); + uint16 bit = value&mask; + if(bit > 0) + { + return 1; + } + else + { + return 0; + }*/ + +} diff --git a/2.3-1/src/c/elementaryFunctions/bitget/u16bitgets.c~ b/2.3-1/src/c/elementaryFunctions/bitget/u16bitgets.c~ new file mode 100644 index 00000000..20593bff --- /dev/null +++ b/2.3-1/src/c/elementaryFunctions/bitget/u16bitgets.c~ @@ -0,0 +1,24 @@ +/* Scilab2C FOSSEE IITB */ + +#include "bitget.h" +#include + +uint16 u16bitgets(uint16 value,int position) +{ + + value = value >> (position -1); + value = value & 1; + return value; + + /*unsigned char mask = 1<<(position-1); + uint16 bit = value&mask; + if(bit > 0) + { + return 1; + } + else + { + return 0; + }*/ + +} diff --git a/2.3-1/src/c/elementaryFunctions/bitget/u8bitgets.c b/2.3-1/src/c/elementaryFunctions/bitget/u8bitgets.c new file mode 100644 index 00000000..130bff86 --- /dev/null +++ b/2.3-1/src/c/elementaryFunctions/bitget/u8bitgets.c @@ -0,0 +1,24 @@ +/* Scilab2C FOSSEE IITB */ + +#include "bitget.h" +#include + +uint8 u8bitgets(uint8 value,int position) +{ + + value = value >> (position -1); + value = value & 1; + return value; + + /*unsigned char mask = 1<<(position-1); + uint8 bit = value&mask; + if(bit > 0) + { + return 1; + } + else + { + return 0; + }*/ + +} diff --git a/2.3-1/src/c/elementaryFunctions/bitget/u8bitgets.c~ b/2.3-1/src/c/elementaryFunctions/bitget/u8bitgets.c~ new file mode 100644 index 00000000..130bff86 --- /dev/null +++ b/2.3-1/src/c/elementaryFunctions/bitget/u8bitgets.c~ @@ -0,0 +1,24 @@ +/* Scilab2C FOSSEE IITB */ + +#include "bitget.h" +#include + +uint8 u8bitgets(uint8 value,int position) +{ + + value = value >> (position -1); + value = value & 1; + return value; + + /*unsigned char mask = 1<<(position-1); + uint8 bit = value&mask; + if(bit > 0) + { + return 1; + } + else + { + return 0; + }*/ + +} diff --git a/2.3-1/src/c/elementaryFunctions/bitor/dbitanda.c~ b/2.3-1/src/c/elementaryFunctions/bitor/dbitanda.c~ new file mode 100644 index 00000000..d411e6e4 --- /dev/null +++ b/2.3-1/src/c/elementaryFunctions/bitor/dbitanda.c~ @@ -0,0 +1,14 @@ +/* Scilab2C FOSSEE IITB */ +#include "bitand.h" + +void dbitanda(double* x,double* y,int size,double* out) +{ + int i = 0; + for(i=0;i + +uint16 u16bitsets(uint16 value,int position,int bit_value) +{ + if(bit_value==1) + { + unsigned char mask1 = 1 << (position-1) ; // we could cast to unsigned char, just to be safe + return (mask1 | value); + } + else + { + unsigned char mask2 = ~(1 << (position-1)); // we could cast to unsigned char, just to be safe + return (mask2 & value); + + } + +} diff --git a/2.3-1/src/c/elementaryFunctions/bitset/u16bitsets.c~ b/2.3-1/src/c/elementaryFunctions/bitset/u16bitsets.c~ new file mode 100644 index 00000000..953e46c9 --- /dev/null +++ b/2.3-1/src/c/elementaryFunctions/bitset/u16bitsets.c~ @@ -0,0 +1,20 @@ +/* Scilab2C FOSSEE IITB */ + +#include "bitset.h" +#include + +uint16 u16bitsets(uint16 value,int position,int bit_value) +{ + if(bit_value==1) + { + unsigned char mask1 = 1 << (position-1) ; // we could cast to unsigned char, just to be safe + return (mask1 | value); + } + else + { + unsigned char mask2 = ~(1 << (position-1)); // we could cast to unsigned char, just to be safe + return (mask2 & value); + + } + +} diff --git a/2.3-1/src/c/elementaryFunctions/bitset/u8bitsets.c b/2.3-1/src/c/elementaryFunctions/bitset/u8bitsets.c new file mode 100644 index 00000000..5f44dcd8 --- /dev/null +++ b/2.3-1/src/c/elementaryFunctions/bitset/u8bitsets.c @@ -0,0 +1,20 @@ +/* Scilab2C FOSSEE IITB */ + +#include "bitset.h" +#include + +uint8 u8bitsets(uint8 value,int position,int bit_value) +{ + if(bit_value==1) + { + unsigned char mask1 = 1 << (position-1) ; // we could cast to unsigned char, just to be safe + return (mask1 | value); + } + else + { + unsigned char mask2 = ~(1 << (position-1)); // we could cast to unsigned char, just to be safe + return (mask2 & value); + + } + +} diff --git a/2.3-1/src/c/elementaryFunctions/bitset/u8bitsets.c~ b/2.3-1/src/c/elementaryFunctions/bitset/u8bitsets.c~ new file mode 100644 index 00000000..5f44dcd8 --- /dev/null +++ b/2.3-1/src/c/elementaryFunctions/bitset/u8bitsets.c~ @@ -0,0 +1,20 @@ +/* Scilab2C FOSSEE IITB */ + +#include "bitset.h" +#include + +uint8 u8bitsets(uint8 value,int position,int bit_value) +{ + if(bit_value==1) + { + unsigned char mask1 = 1 << (position-1) ; // we could cast to unsigned char, just to be safe + return (mask1 | value); + } + else + { + unsigned char mask2 = ~(1 << (position-1)); // we could cast to unsigned char, just to be safe + return (mask2 & value); + + } + +} diff --git a/2.3-1/src/c/elementaryFunctions/bitxor/dbitanda.c~ b/2.3-1/src/c/elementaryFunctions/bitxor/dbitanda.c~ new file mode 100644 index 00000000..d411e6e4 --- /dev/null +++ b/2.3-1/src/c/elementaryFunctions/bitxor/dbitanda.c~ @@ -0,0 +1,14 @@ +/* Scilab2C FOSSEE IITB */ +#include "bitand.h" + +void dbitanda(double* x,double* y,int size,double* out) +{ + int i = 0; + for(i=0;i