src/sap.ui.core/src/jquery.sap.history.js
function calculateStepsToHash(sCurrentHash, sToHash, bPrefix){
			var iCurrentIndex = jQuery.inArray(sCurrentHash, hashHistory),
				iToIndex,
				i,
				tempHash;
			if (iCurrentIndex > 0) {
				if (bPrefix) {
					for (i = iCurrentIndex - 1; i >= 0 ; i--) {
						tempHash = hashHistory[i];
						if (tempHash.indexOf(sToHash) === 0 && !isVirtualHash(tempHash)) {
							return i - iCurrentIndex;
						}
					}
				} else {
					iToIndex = jQuery.inArray(sToHash, hashHistory);

					//When back to home is needed, and application is started with nonempty hash but it's nonbookmarkable
					if ((iToIndex === -1) && sToHash.length === 0) {
						return -1 * iCurrentIndex;
					}

					if ((iToIndex > -1) && (iToIndex < iCurrentIndex)) {
						return iToIndex - iCurrentIndex;
					}
				}
			}

			return 0;
		}
function calculateStepsToHash(sCurrentHash, sToHash, bPrefix){
			var iCurrentIndex = jQuery.inArray(sCurrentHash, hashHistory),
				iToIndex,
				i,
				tempHash;
			if (iCurrentIndex > 0) {
				if (bPrefix) {
					for (i = iCurrentIndex - 1; i >= 0 ; i--) {
						tempHash = hashHistory[i];
						if (tempHash.indexOf(sToHash) === 0 && !isVirtualHash(tempHash)) {
							return i - iCurrentIndex;
						}
					}
				} else {
					iToIndex = jQuery.inArray(sToHash, hashHistory);

					//When back to home is needed, and application is started with nonempty hash but it's nonbookmarkable
					if ((iToIndex === -1) && sToHash.length === 0) {
						return -1 * iCurrentIndex;
					}

					if ((iToIndex > -1) && (iToIndex < iCurrentIndex)) {
						return iToIndex - iCurrentIndex;
					}
				}
			}

			return 0;
		}
function calculateStepsToHash ( sCurrentHash , sToHash , bPrefix ) { var iCurrentIndex = jQuery . inArray ( sCurrentHash , hashHistory ) , iToIndex , i , tempHash ; if ( iCurrentIndex > 0 ) { if ( bPrefix ) { for ( i = iCurrentIndex - 1 ; i >= 0 ; i -- ) { tempHash = hashHistory [ i ] ; if ( tempHash . indexOf ( sToHash ) === 0 && ! isVirtualHash ( tempHash ) ) { return i - iCurrentIndex ; } } } else { iToIndex = jQuery . inArray ( sToHash , hashHistory ) ; //When back to home is needed, and application is started with nonempty hash but it's nonbookmarkable if ( ( iToIndex === - 1 ) && sToHash . length === 0 ) { return - 1 * iCurrentIndex ; } if ( ( iToIndex > - 1 ) && ( iToIndex < iCurrentIndex ) ) { return iToIndex - iCurrentIndex ; } } } return 0 ; }
This function calculates the number of steps from the sCurrentHash to sToHash. If the sCurrentHash or the sToHash is not in the history stack, it returns 0.

@private
This function calculates the number of steps from the sCurrentHash to sToHash . If the sCurrentHash or the sToHash is not in the history stack it returns 0 .