yup, convert everything to 32-bit representation (assuming IPv4). if your mask is M and ip is IP, then your ip range is (M&IP)+1,(M&IP)+2,...,(M&IP)+(~M)-1. where & is bitwise AND and ~ is bitwise not.
to convert things to 32-bit representation, each spot in the ip a.b.c.d is an 8-bit number.