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_UINT16 00045 #endif 00046 00047 #include "ov-base-int.h" 00048 #include "ov-base-int.cc" 00049 #include "ov-uint16.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<uint16NDArray>; 00060 00061 template class octave_base_int_matrix<uint16NDArray>; 00062 00063 DEFINE_OCTAVE_ALLOCATOR (octave_uint16_matrix); 00064 00065 DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA (octave_uint16_matrix, 00066 "uint16 matrix", "uint16"); 00067 00068 template class octave_base_scalar<octave_uint16>; 00069 00070 template class octave_base_int_scalar<octave_uint16>; 00071 00072 DEFINE_OCTAVE_ALLOCATOR (octave_uint16_scalar); 00073 00074 DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA (octave_uint16_scalar, 00075 "uint16 scalar", "uint16"); 00076 00077 DEFUN (uint16, args, , 00078 "-*- texinfo -*-\n\ 00079 @deftypefn {Built-in Function} {} uint16 (@var{x})\n\ 00080 Convert @var{x} to unsigned 16-bit integer type.\n\ 00081 @end deftypefn") 00082 { 00083 OCTAVE_TYPE_CONV_BODY (uint16); 00084 } 00085 00086 /* 00087 00088 %!assert (class (uint16 (1)), "uint16") 00089 %!assert (uint16 (1.25), uint16 (1)) 00090 %!assert (uint16 (1.5), uint16 (2)) 00091 %!assert (uint16 (-1.5), uint16 (0)) 00092 %!assert (uint16 (2^17), uint16 (2^16-1)) 00093 %!assert (uint16 (-2^17), uint16 (0)) 00094 00095 */ 00096