001 /******************************************************************************* 002 * Copyright (C) 2009-2011 FuseSource Corp. 003 * 004 * All rights reserved. This program and the accompanying materials 005 * are made available under the terms of the Eclipse Public License v1.0 006 * which accompanies this distribution, and is available at 007 * http://www.eclipse.org/legal/epl-v10.html 008 *******************************************************************************/ 009 package org.fusesource.hawtjni.runtime; 010 011 /** 012 * 013 * @author <a href="http://hiramchirino.com">Hiram Chirino</a> 014 */ 015 public class PointerMath { 016 017 private static final boolean bits32 = Library.getBitModel() == 32; 018 019 final public static long add(long ptr, long n) { 020 if(bits32) { 021 return (int)(ptr + n); 022 } else { 023 return ptr + n; 024 } 025 } 026 027 }