[retval] = fd3(fid) read a 3 byte integer out of a file
0001 function [retval] = fd3(fid) 0002 % [retval] = fd3(fid) 0003 % read a 3 byte integer out of a file 0004 0005 0006 % 0007 % fread3.m 0008 % 0009 % Original Author: Bruce Fischl 0010 % CVS Revision Info: 0011 % $Author: nicks $ 0012 % $Date: 2007/01/10 22:55:09 $ 0013 % $Revision: 1.2 $ 0014 % 0015 % Copyright (C) 2002-2007, 0016 % The General Hospital Corporation (Boston, MA). 0017 % All rights reserved. 0018 % 0019 % Distribution, usage and copying of this software is covered under the 0020 % terms found in the License Agreement file named 'COPYING' found in the 0021 % FreeSurfer source code root directory, and duplicated here: 0022 % https://surfer.nmr.mgh.harvard.edu/fswiki/FreeSurferOpenSourceLicense 0023 % 0024 % General inquiries: freesurfer@nmr.mgh.harvard.edu 0025 % Bug reports: analysis-bugs@nmr.mgh.harvard.edu 0026 % 0027 0028 b1 = fread(fid, 1, 'uchar') ; 0029 b2 = fread(fid, 1, 'uchar') ; 0030 b3 = fread(fid, 1, 'uchar') ; 0031 retval = bitshift(b1, 16) + bitshift(b2,8) + b3 ; 0032