Home

Learning Go(1) Vector Add In Go

Every time I started to learn a new programming language that supports multi-threading, the “hello world” program to me is vector adding. Vector adding is very simple in logic, and involves almost every fundamental operations that a parallel program would use, such as creating threads, waiting for threads finished, and setting mutex, etc. So, implementing a vector add program in go is a good stepping stone for me to learn how to use goroutine to achieve concurrency.

Read more

Multi-touch Screen Technology

Intro

Multi-touch screen have been developed over the last decades providing a more convenient way for human-computer interaction. In recent years, touch gesture based applications have been growing fastly due to the combination of the smartphone, tablet, and multi-touch screen.

This article aims to briefly explain the technology, architecture, principles of today’s multi-touch screens and the driver software for gesture recognition in smart phones.

Read more

MIMO Radio and Antenna Array Technology

Intro

Traditional multiple-input multiple-output (MIMO) systems may have two or four, some may even have eight antennas, and this has been adopted in some early systems such as 3G and 4G communication systems. Large MIMO systems, often referred to as massive MIMO systems, can be defined as those that use tens or hundreds of antennas in the communication terminals. Massive MIMO systems combined with beamforming antenna array technologies are expected to play a key role in next-generation wireless communication system (5G).

This article aims to briefly summarize the architecture and principles of MIMO radio and antenna array technology to achieve beamforming and improved QoS using software-steered radio signals, along with the key improvements from 4G to 5G in MIMO radio, smart antenna, and channel width area.

Read more

An Innovative Use of Right Shifting in C/C++

When I was optimizing a piece of C++ code, I noticed a very odd behavior of C++ programs in handling shiftings, that right shifting a negative integer to its least significant 1 will result a -1.

e.g.

int16_t i = (1 << 15) >> 15;
printf("%d\n", i);
> -1

This bit hacking techinique could be beneficial in optimizing some C++ programs. For example, here is a simple comparison between two integers, it conducts as following

// a generic approach
if (a > b) tmp = a;
else if (a < b>) tmp = b;

The generic approach is equivalent with the following piece of code, but shows a better performance

// a bit hacking approach
int mask = (a-b) >> 31;
tmp = (mask & a) | (~mask & b);

Read more