set_bit

./efun/set_bit · 741 B

From the archive driver-docs-3.2@238-07-dec-93.tar.gz

Download the archive   « Back to the archive contents

SYNOPSIS
	string set_bit(string str, int n)

DESCRIPTION
	Return the new string where bit n is set in string str. Note
	that the old string str is not modified.
	
	Each character contains 6 bits. So you can store a value
	between 0 and 63 in one character (2^6=64). Starting character
	is the blank " " which has the value 0. The first charcter in
	the string is the one with the lowest bits (0-5).
	
	The new string will automatically be extended if needed.

EXAMPLES
	string s;
	s=set_bit("?",5);
	
	Because "?" has a valueof 31 the variable s will now contain
	the charcter "_" wich is equal to 63 (31+2^5=63).
	
	string s;
	s=set_bit("78",3);
	s=set_bit(s,8);
	
	s will now contain the string "?<".
	
SEE ALSO
	clear_bit(E), test_bit(E)

Site Stats

Snippets: 1791
Codebases: 571