src/generate_param_byte.c
/*
**	This function will take a line and generate the param-byte for it.
**	"sti r1, 2, %3" will return 0b 01 11 10 00.
*/
This function will take a line and generate the param-byte for it.
This function will take a line and generate the param - byte for it .
char		generate_param_byte(char *line)
{
	char	**words;
	int		len;
	char	result;
	words = ft_strsplit(line, ' ');
	len = 0;
	while (words[len])
		len++;
	if (len >= 2)
	{
		result = 0b11000000 & parse_param(words[1]);
		if (len >= 3)
		{
			result |= 0b00110000 & parse_param(words[2]);
			if (len >= 4)
				result |= 0b00001100 & parse_param(words[3]);
		}
	}
	else
		result = 0b00000000;
	ft_strarrdel(&words);
	return (result);
}
char generate_param_byte ( char * line ) { char * * words ; int len ; char result ; words = ft_strsplit ( line , ' ' ) ; len = 0 ; while ( words [ len ] ) len ++ ; if ( len >= 2 ) { result = 0b11000000 & parse_param ( words [ 1 ] ) ; if ( len >= 3 ) { result |= 0b00110000 & parse_param ( words [ 2 ] ) ; if ( len >= 4 ) result |= 0b00001100 & parse_param ( words [ 3 ] ) ; } } else result = 0b00000000 ; ft_strarrdel ( & words ) ; return ( result ) ; }
This function will take a line and generate the param-byte for it.
This function will take a line and generate the param - byte for it .