Gameloft interview question

Write a function to convert RGB888 to RGB565.