binary encode working for memory and immediate