/* Copy the PrefixLength bits from Src to Dest. */
VOID Ip6CopyAddressByPrefix(OUT EFI_IPv6_ADDRESS *Dest, IN EFI_IPv6_ADDRESS *Src, IN UINT8 PrefixLength)
/* Copy the PrefixLength bits from Src to Dest. */
VOID Ip6CopyAddressByPrefix(OUT EFI_IPv6_ADDRESS *Dest, IN EFI_IPv6_ADDRESS *Src, IN UINT8 PrefixLength)
{
  UINT8  Byte;
  UINT8  Bit;
  UINT8  Mask;
  ASSERT (Dest != NULL && Src != NULL);
  ASSERT (PrefixLength <= IP6_PREFIX_MAX);
  Byte = (UINT8)(PrefixLength / 8);
  Bit  = (UINT8)(PrefixLength % 8);
  ZeroMem (Dest, sizeof (EFI_IPv6_ADDRESS));
  CopyMem (Dest, Src, Byte);
  if (Bit > 0) {
    Mask = (UINT8)(0xFF << (8 - Bit));
    ASSERT (Byte < 16);
    Dest->Addr[Byte] = (UINT8)(Src->Addr[Byte] & Mask);
  }
}