inlining methods in slang

Martin Kuball MartinKuball at web.de
Sun May 1 16:15:21 UTC 2005


Hi!

I'm writing a xvid plugin and have the following problem. I to make 
the plugin code more readable I wrote a small method that should be 
inlined into the c-code whenever it is called:

insert: color into: output at: offset
 | intColor |
 intColor _ self cCoerce: color to: 'int'.
 output at: offset put: (0 max: (255 min: intColor))

That works. But in addition the generator outputs code for the method 
itself. But that code does not compile because the generator 
generates code with output as an int var.

Now declaring outpus as a pointer like:

insert: color into: output at: offset

 | intColor |
 self var: #output type: 'unsigned char*'.
 intColor _ self cCoerce: color to: 'int'.
 output at: offset put: (0 max: (255 min: intColor))

does help, but now the method is not inlined any more. Even forcing 
inlining using 
 self inline: true

does not help.

Martin



More information about the Squeak-dev mailing list