public static long parseFileSize(final byte[] buffer, final int offset, final int length) {
		long result = 0;
		int end = offset + length;
		int start = offset;
		int j = 0;
		int k = 0;

		for (int i = start; i < end; i++) {
			// check for 0xffffffff buffer value, a special case
			if (buffer[i] == -1)
				k++;

			// compute integer result
			result += ((long) buffer[i] & 0xFF) << (8 * j);
			j++;
		}

		// if special case was found (ex, for a dir header), return 0 as size
		if (k < 4) {
			return result;
		}
		return 0;
	}
compute the file size, set file size to 0 if object type is dir
Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/yaffs2/YAFFS2Utils.java