Back to index

texmacs  1.0.7.15
vpenalty.cpp
Go to the documentation of this file.
00001 
00002 /******************************************************************************
00003 * MODULE     : vpenalty.cpp
00004 * DESCRIPTION: Vertical penalties
00005 * COPYRIGHT  : (C) 1999  Joris van der Hoeven
00006 *******************************************************************************
00007 * This software falls under the GNU general public license version 3 or later.
00008 * It comes WITHOUT ANY WARRANTY WHATSOEVER. For details, see the file LICENSE
00009 * in the root directory or <http://www.gnu.org/licenses/gpl-3.0.html>.
00010 ******************************************************************************/
00011 
00012 #include "vpenalty.hpp"
00013 
00014 tm_ostream&
00015 operator << (tm_ostream& out, vpenalty pen) {
00016   return out << "[ " << pen->pen << ", " << pen->exc << " ]";
00017 }
00018 
00019 vpenalty
00020 as_vpenalty (SI diff) {
00021   if (diff < 0) diff= -diff;
00022   if (diff < 0x1000) return vpenalty (0, (diff*diff) >> 16);
00023   else if (diff < 0x100000) return vpenalty (0, (diff >> 8) * (diff >> 8));
00024   else return vpenalty (0, 0x1000000);
00025 }