summaryrefslogtreecommitdiff
path: root/src/Scilab2C/GeneralFunctions/SizeInByte.sci
diff options
context:
space:
mode:
Diffstat (limited to 'src/Scilab2C/GeneralFunctions/SizeInByte.sci')
-rw-r--r--src/Scilab2C/GeneralFunctions/SizeInByte.sci31
1 files changed, 31 insertions, 0 deletions
diff --git a/src/Scilab2C/GeneralFunctions/SizeInByte.sci b/src/Scilab2C/GeneralFunctions/SizeInByte.sci
new file mode 100644
index 00000000..5fcf4e08
--- /dev/null
+++ b/src/Scilab2C/GeneralFunctions/SizeInByte.sci
@@ -0,0 +1,31 @@
+function SizeIn = SizeInByte(InDataType);
+// function SizeIn = SizeInByte(InDataType);
+// -----------------------------------------------------------------
+// Returns the size in bytes of the input data type.
+//
+// Input data:
+// InDataType: input data type. It can be:
+// 'float'
+// 'double'
+// 'floatComplex*'
+// 'doubleComplex*'
+//
+// Output data:
+// SizeIn: size in bytes of the input data type.
+//
+// Status:
+// 12-May-2007 -- Nutricato Raffaele: Author.
+// -----------------------------------------------------------------
+
+if (InDataType == 'float')
+ SizeIn = 4;
+elseif (InDataType == 'double')
+ SizeIn = 8;
+elseif (InDataType == 'floatComplex*')
+ SizeIn = 8;
+elseif (InDataType == 'doubleComplex*')
+ SizeIn = 16;
+else
+ error('Unknown data type: '+InDataType);
+end
+endfunction