public static int getInitializedByteCount(byte[] initializedMask, int pageOffset, int size) {
		if (initializedMask == null) {
			return size;
		}
		int initializedSize = 0;
		int maskOffset = pageOffset / 8;
		int firstBit = pageOffset % 8;
		while (size > 0) {
			int s = Math.min(size, 8 - firstBit); // number of bytes represented by mask
			size -= s;
			int mask = (0xff << firstBit) & ((1 << (firstBit + s)) - 1);
			int result = initializedMask[maskOffset] & mask;
			if (result != mask) {
				// count leading bits
				for (result >>= firstBit; (result & 1) != 0; result >>= 1) {
					++initializedSize;
				}
				return initializedSize;
			}
			initializedSize += s;
			++maskOffset;
			firstBit = 0;
		}
		return initializedSize;
	}
Determine how many leading bytes of a specified page region is marked as
initialized.  Valid page region defined by pageOffset and size is assumed.
@param initializedMask
@param pageOffset
@param size 
@return number of leading bytes at pageOffset (upto size) are initialized.
Ghidra/Framework/Emulation/src/main/java/ghidra/pcode/memstate/MemoryPage.java