001    /**
002     * Implements the CFML Function bitmaskclear
003     */
004    package railo.runtime.functions.math;
005    
006    import railo.runtime.PageContext;
007    import railo.runtime.exp.FunctionException;
008    import railo.runtime.ext.function.Function;
009    
010    public final class BitMaskClear implements Function {
011            public static double call(PageContext pc , double dnumber, double dstart, double dlength) throws FunctionException {
012    
013                    int number=(int) dnumber,start=(int) dstart,length=(int) dlength;
014                    
015                    if(start > 31 || start < 0)
016                            throw new FunctionException(pc,"bitMaskClear",2,"start","must be beetween 0 and 31 now "+start);
017                    if(length > 31 || length < 0)
018                            throw new FunctionException(pc,"bitMaskClear",3,"length","must be beetween 0 and 31 now "+length);
019                    
020                    
021                    return number & ~((1 << length) - 1 << start);
022            }
023    }