/* Compute the window scale value according to the given buffer size. */
UINT8 TcpComputeScale(IN TCP_CB *Tcb)
/* Compute the window scale value according to the given buffer size. */
UINT8 TcpComputeScale(IN TCP_CB *Tcb)
{
  UINT8   Scale;
  UINT32  BufSize;
  ASSERT ((Tcb != NULL) && (Tcb->Sk != NULL));
  BufSize = GET_RCV_BUFFSIZE (Tcb->Sk);
  Scale = 0;
  while ((Scale < TCP_OPTION_MAX_WS) && ((UINT32)(TCP_OPTION_MAX_WIN << Scale) < BufSize)) {
    Scale++;
  }
  return Scale;
}