X-Code is one of the most important redundant array of independent disk (RAID)-6 codes which are capable of tolerating double disk failures. However, the code length of X-Code is restricted to be a prime number, and such code length restriction of X-Code limits its usage in the real storage systems. Moreover, as a vertical RAID-6 code, X-Code can not be extended easily to an arbitrary code length like horizontal RAID-6 codes. In this paper, a novel and efficient code shortening algorithm for X-Code is proposed to extend X-Code to an arbitrary length. It can be further proved that the code shortening algorithm maintains the maximum-distance-separable (MDS) property of X-Code, and namely, the shortened X-Code is still MDS code with the optimal space efficiency. In the context of the shortening algorithm for X-Code, an in-depth performance analysis on X-Code at consecutive code lengths is conducted, and the impacts of the code shortening algorithm on the performance of X-Code in various performance metrics are revealed.