ov-int8.cc

Go to the documentation of this file.
00001 /*
00002 
00003 Copyright (C) 2004-2012 John W. Eaton
00004 
00005 This file is part of Octave.
00006 
00007 Octave is free software; you can redistribute it and/or modify it
00008 under the terms of the GNU General Public License as published by the
00009 Free Software Foundation; either version 3 of the License, or (at your
00010 option) any later version.
00011 
00012 Octave is distributed in the hope that it will be useful, but WITHOUT
00013 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00014 FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
00015 for more details.
00016 
00017 You should have received a copy of the GNU General Public License
00018 along with Octave; see the file COPYING.  If not, see
00019 <http://www.gnu.org/licenses/>.
00020 
00021 */
00022 
00023 #ifdef HAVE_CONFIG_H
00024 #include <config.h>
00025 #endif
00026 
00027 #include <climits>
00028 
00029 #include <iostream>
00030 
00031 #include "lo-ieee.h"
00032 #include "lo-utils.h"
00033 #include "mx-base.h"
00034 #include "quit.h"
00035 
00036 #include "defun.h"
00037 #include "gripes.h"
00038 #include "oct-obj.h"
00039 #include "oct-lvalue.h"
00040 #include "ops.h"
00041 #include "ov-base.h"
00042 
00043 #ifdef HAVE_HDF5
00044 #define HDF5_SAVE_TYPE H5T_NATIVE_INT8
00045 #endif
00046 
00047 #include "ov-base-int.h"
00048 #include "ov-base-int.cc"
00049 #include "ov-int8.h"
00050 #include "ov-type-conv.h"
00051 #include "pr-output.h"
00052 #include "variables.h"
00053 
00054 #include "byte-swap.h"
00055 #include "ls-oct-ascii.h"
00056 #include "ls-utils.h"
00057 #include "ls-hdf5.h"
00058 
00059 template class octave_base_matrix<int8NDArray>;
00060 
00061 template class octave_base_int_matrix<int8NDArray>;
00062 
00063 DEFINE_OCTAVE_ALLOCATOR (octave_int8_matrix);
00064 
00065 DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA (octave_int8_matrix,
00066                                      "int8 matrix", "int8");
00067 
00068 template class octave_base_scalar<octave_int8>;
00069 
00070 template class octave_base_int_scalar<octave_int8>;
00071 
00072 DEFINE_OCTAVE_ALLOCATOR (octave_int8_scalar);
00073 
00074 DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA (octave_int8_scalar,
00075                                      "int8 scalar", "int8");
00076 
00077 DEFUN (int8, args, ,
00078   "-*- texinfo -*-\n\
00079 @deftypefn {Built-in Function} {} int8 (@var{x})\n\
00080 Convert @var{x} to 8-bit integer type.\n\
00081 @end deftypefn")
00082 {
00083   OCTAVE_TYPE_CONV_BODY (int8);
00084 }
00085 
00086 /*
00087 
00088 %!assert (class (int8 (1)), "int8")
00089 %!assert (int8 (1.25), int8 (1))
00090 %!assert (int8 (1.5), int8 (2))
00091 %!assert (int8 (-1.5), int8 (-2))
00092 %!assert (int8 (2^9), int8 (2^8-1))
00093 %!assert (int8 (-2^9), int8 (-2^8))
00094 
00095 */
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Defines